Horje
How I use Cockpit for my Home's Linux Server Management

Cockpit is a free, open-source, and easy-to-use yet powerful remote manager for Linux servers that allows system administrators to quickly monitor or manage system resources, logs, storage, network, background services, and much more from one central dashboard.

You can also access the Linux shell of different Linux servers from the Cockpit web interface, and manage other users and services on those servers. Any errors that appear will be directly shown in the Cockpit logs.

Ansible, Docker, Kubernetes, and other DevOps tools are compatible with Cockpit. The best part about Cockpit is that it doesn’t consume resources unnecessarily, as it only runs on demand, thanks to system socket activation.

In this guide, you will learn more about its features, how to install Cockpit on major Linux distributions, and how to use it to manage your different Linux servers.

Features of the Cockpit

The following is a list of features or tasks you can perform with Cockpit.

  • It is free, open-source, easy to use, and available for most Linux distributions.
  • Add, remove, and manage multiple Linux servers from one central dashboard.
  • Monitor the Linux server’s CPU, memory, disk, or network status.
  • Start containers, manage storage, configure networks, or inspect logs.
  • Access the web-based Linux shells of the added Linux servers.
  • Add, modify, or remove users from the Linux servers.
  • Ansible, Docker, Kubernetes, and other DevOps tools are supported.

How to Install Cockpit in Linux

Most Linux distributions now include the Cockpit package, and you can quickly install and start Cockpit services using built-in commands. However, when following the installation steps, consider using a POSIX-compatible shell like Bash. If you are currently using different shells, then switch to Bash using the “bash -i” command.

Install Cockpit on Debian and Ubuntu

The Cockpit is included in Debian, Ubuntu, or Linux Mint official repositories, and you can install it using the following commands:

$ sudo apt update
$ sudo apt install cockpit
$ sudo ufw allow 9090
$ sudo ufw allow 80

Install Cockpit on Fedora

The Cockpit comes pre-installed with Fedora Server, and desktop users or those using different variants of Fedora can run the following commands to install it:

$ sudo dnf install cockpit
$ sudo systemctl enable --now cockpit.socket
$ sudo firewall-cmd --add-service=cockpit
$ sudo firewall-cmd --add-service=cockpit --permanent

Install Cockpit on Red Hat

The Cockpit is now available in Red Hat Enterprise Linux starting with version 7, and users can install it using these commands.

$ sudo yum install cockpit
$ sudo systemctl enable --now cockpit.socket
$ sudo firewall-cmd --add-service=cockpit
$ sudo firewall-cmd --add-service=cockpit --permanent

Install Cockpit on Arch Linux

Arch Linux users can install Cockpit from the Arch User Repository with the following commands:

$ sudo pacman -S cockpit
$ sudo systemctl enable --now cockpit.socket

Install Cockpit on Clear Linux

Clear Linux OS users can install Cockpit using the “swupd” command-line program:

$ sudo swupd bundle-add sysadmin-remote
$ sudo systemctl enable --now cockpit.socket

Install Cockpit on OpenSUSE Tumbleweed and Leap

The Cockpit is available in both OpenSUSE Tumbleweed and Leap starting with version 15.6, and users can install it using the following commands:

$ sudo zypper in cockpit
$ sudo systemctl enable --now cockpit.socket
$ sudo firewall-cmd --permanent --zone=public --add-service=cockpit
$ sudo firewall-cmd --reload

How to Use Cockpit in Linux

Step 1: Once the installation is complete and the Cockpit service starts, the IP address or hostname of the Linux server hosting it will expose port 9090 to the internet, enabling access to the Cockpit dashboard.

https://ip-address:9090

OR

https://yourdomain.com:9090

Step 2: When you access it for the first time, it will ask you to enter a system username and password to login.

Cockpit login

Step 3: Once you successfully log in, you will be redirected to the Overview dashboard, where you can monitor CPU, memory, storage, and network status, as well as check other system and hardware information.

If you’ve logged in as the root user, you can proceed; otherwise, if you’ve logged in with a normal user account or a user with sudo access, ensure you click on the “Turn on administrative access” button as indicated below to get admin access.

cockpit-home-dashboard

Cockpit dashboard

Step 4: Next, from the left panel, you can switch to the Logs tab, where you can review logs from the last seven days, including emergency, alert, critical, warning, error, and other types. Clicking on a specific log entry allows for further inspection.

checking-logs-in-cockpit

Checking logs in Cockpit

Step 5: You can navigate to the Services tab to view the pages for Services, Targets, Sockets, Timers, and Paths.

checking-services-in-cockpit

Checking services in Cockpit

Step 6: You can further manage the services by starting, stopping, restarting, or checking their path, memory usage, and logs. To perform these actions, simply click on the individual service from the list to redirect to the service page.

managing-single-service-in-cockpit

Managing services in Cockpit

Step 7: To manage users, verify their full name, user ID, the list of groups they belong to, available groups, or check users with sudo privileges, move to the Accounts tab.

managing-users-in-cockpit

Managing users in Cockpit

Step 8: To add a new user, click on the “Create new account” button and enter the necessary user information, such as full name, username, home directory, default login shell, and password.

Note: While creating the user account, you cannot add the user to the sudo group, but you can edit the user account afterward to do so.

adding-new-user-account-from-cockpit

Step 9: Finally, you can navigate to the Terminal tab to access the Linux terminal of the server.

access-the-Linux-shell-of-the-Linux-server-from-cockpit

Accessing the Linux shell from Cockpit

How to Add More Linux Servers to Cockpit

To manage your other Linux servers from a single Cockpit dashboard, you can simply install Cockpit and SSH on all your remote Linux servers using the same method described in this article.

Afterward, access the Cockpit dashboard from where you want to manage your other Linux server, click on the dropdown in the left panel next to your username, and select “Add new host“.

adding-new-host-in-cockpit

Adding new host in Cockpit

A prompt will appear asking you to enter the IP address or hostname of the other Linux server (ensure Cockpit and SSH are already installed and running on them), provide the system username, and then click on “Add“.

adding-Linux-server-to-cockpit

Adding Linux server to Cockpit

Afterward, the new host entry will be added to the left panel, allowing you to switch to your other Linux server’s Cockpit dashboard.

accessing-other-Linux-server-in-cockpit

Managing multiple Linux server in Cockpit

Conclusion

Cockpit is a highly useful and user-friendly remote manager that you can install on a single Linux instance and later add additional Linux servers from the Cockpit dashboard for centralized management.

This way, you can conveniently and efficiently manage your homelabs or servers running different services like Ansible, Kubernetes, Jellyfin, or Nextcloud through a graphical web interface.

How I use Cockpit for my home’s Linux server management-FAQ

What is Cockpit?

Cockpit is a free, open-source, and easy-to-use remote manager for Linux servers. It allows system administrators to monitor and manage system resources, logs, storage, network, and services from one central dashboard.

How do I manage multiple Linux servers with Cockpit?

Install Cockpit and SSH on all remote Linux servers. From the Cockpit dashboard, click on the dropdown next to your username and select “Add new host”. Provide the IP address or hostname with the system username, and then click “Add”.

Can I manage users with Cockpit?

Yes, you can manage users by navigating to the Accounts tab.

Is Cockpit resource-intensive?

No, Cockpit is designed to be efficient and only runs on demand, utilizing system socket activation to minimize resource usage.




Reffered: https://www.geeksforgeeks.org


Linux Unix

Related
Check and Monitor Active GPU in Linux Check and Monitor Active GPU in Linux
Privileged access management (PAM) for linux and unix Privileged access management (PAM) for linux and unix
How to Set up a Wireless Network in Linux How to Set up a Wireless Network in Linux
What is GitLeaks and How to Use It? What is GitLeaks and How to Use It?
How to Install Ubuntu Server Edition with LXD Containers? How to Install Ubuntu Server Edition with LXD Containers?

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
17