How to Manage Linux Servers with the Cockpit Web Interface

A terminal window on a Linux computer system.Fatmawati Achmad Zaenuri / Shutterstock

You can easily monitor and manage multiple Linux computers with Cockpit, a browser-based dashboard and administration tool. It is stand-alone, simple to configure and easy to use. We’ll show you how to get started.

Managing multiple Linux servers

If you have multiple Linux computers or servers to monitor, you have a challenge. This is especially true if some of them operate as headless systems with no monitor connected. For example, you might have rack-mounted or remote servers located in different buildings or a collection of Raspberry Pi scattered around your house.

How can you monitor the health and performance of all of these?

If you use Secure Shell (SSH) to connect to it, you can run top or another terminal-based monitoring tool. You will get useful information, but each tool has its own area of ​​interest. It is inconvenient to have to switch between tools to view the different metrics of your remote Linux computer.

Unfortunately, there is no convenient way to switch between tools that provide you with some of this information. In addition, if you need to perform corrective or administrative tasks, you must establish a new connection to the remote computer or close the monitoring application. Next, you need to use your existing SSH session to run your administrative commands.

Cockpit connects many common monitoring and administration requirements into a browser-based console, making it easy to monitor and maintain multiple Linux computers.

Cockpit obtains its information from application programming interfaces (APIs) which already exist in Linux. Since the information comes directly from the source, there is no personalized collection or generation of the information, so it can be considered unaltered.

Cockpit and user accounts

Cockpit uses your Linux login credentials, so there is no need to configure the users inside. To log into Cockpit, all you need to do is use your current username and password. If you have accounts on different Linux computers that use the same username and password, Cockpit will use those credentials to log into the remote machines.

Of course, using the same password on different computers is a security risk and is considered bad practice. However, if you only work with local computers that are not exposed to the internet, you can conclude that the risk is low enough.

A much better solution, however, is to configure SSH keys on each computer and then allow Cockpit to use them to connect to remote computers.

RELATED: How to create and install SSH keys from Linux shell

Cockpit installation

Cockpit is in the core repositories of major Linux families. To install Cockpit on Ubuntu, type the following:

sudo apt-get install cockpit

sudo apt-get install cockpit in a terminal window

On Fedora, the command is:

sudo dnf install the cockpit

sudo dnf install the cockpit in a terminal window

On Manjaro, you need to install Cockpit and a package called packagekit. This platform-independent package sits on top of a Linux distribution’s native package management system. It provides a consistent API for application software.

Developers can write software that works with packagekit, and their software can then talk to the package manager of any Linux distribution. This means that they don’t need to write a version that will work with dnf, another for pacman, etc.

Fortunately, packagekit is already installed on Ubuntu and Fedora, so you just need to type the following two commands:

sudo pacman -Sy cockpit

sudo dnf install the cockpit in a terminal window

sudo pacman -Sy packagekit

sudo pacman packagekit in a terminal window

Launch cockpit

To start using Cockpit, open your browser, type the following in the address bar, then press Enter:

localhost: 9090

You should then see the cockpit login screen. If an error appears telling you that the site cannot be reached or the connection has been refused, you may need to type the following commands to enable and start the Cockpit daemon:

sudo systemctl activate cockpit

sudo systemctl activate the cockpit in a terminal window

sudo systemctl start cockpit

sudo systemctl start cockpit in a terminal window

When launching Cockpit, the connection screen appears; just log in with your existing Linux credentials.

To connect to other computers using these same credentials, check the box next to “Reuse my password for remote connections”. If you are using SSH keys to connect to remote computers, or if you are not monitoring other remote machines at all, you can leave this box unchecked.

Cockpit login screen


The Cockpit web page is completely responsive and will adjust sensibly if you change the size of your browser window.

Cockpit sidebar in a browser window

The main view has a list of task categories in a sidebar on the left, while the rest of the window contains information about the selected category. The default view is “Presentation”.

Display of cockpit CPU usage in the main window

Cockpit also adapts when using it on a phone.

Cockpit running on an Android mobile phone

On our test computer, we see that an error was reported because a service failed.

Service failure error message in overview in a browser window.

We click on the “1 service failed” link to switch to the System Services view. the System Security Services Daemon (SSSD) failed to start, so we click on the “sssd” link to go to the SSSD control page.

SSSD Daemon Failure Highlighted in Cockpit in a Browser Window

We click on “Start the service”.

SSSD control page in Cockpit in a browser window

With the service running, we can explore our monitored system further.

SSD service running normally in Cockpit in a browser window

You can click on “Overview” if it is visible in the sidebar. otherwise, just click on the System icon and then click “Overview”.

CPU and memory graphics

In the CPU and Memory Usage pane, click “Show Graphics”.

Cockpit CPU and Memory Usage Display in a Browser Window

The following graphics are displayed:

“CPU usage”: Combined CPU usage for the total number of processors.
“Memory and exchange”: RAM memory and swap usage.
“Disk I / O”: The hard drive reads and writes.
“Network traffic”: All traffic entering and leaving the computer.

Overview graphics in Cockpit in a browser window

If you click on the name of each graph, however, you can see more detailed information:

If you click on “Disk I / O”, you see the same information as under “Storage” in the sidebar.
If you click on “Network traffic”, you see the same information as under “Network” in the sidebar.

Software updates

You can click “Software Updates” in the sidebar to see a list of available updates.

Software updates available in Cockpit in a browser window

To install them, simply click on “Install all updates”.

Updates in progress in Cockpit in a browser window

Monitoring multiple computers

Before trying to monitor another computer, do the following:

Install Cockpit on the other computer, then log into Cockpit to verify that it is working. The browser interface does not need to be running on the remote machine when you are monitoring it remotely. However, if you do, it will prove that Cockpit has been installed correctly and is fully operational.
Use SSH to remotely connect to the other computer from the one you are monitoring it on. Confirm that you can use SSH on the remote computer, and then log in using your current ID and password or SSH keys.

Making sure these two steps work as expected makes it easier to monitor a remote computer. Remember that if you are connecting to remote hosts with the same username and password as your monitoring computer, you must check the “Reuse my password for remote connections” box.

On the monitoring computer, click the drop-down arrow next to the host.

The drop-down list of hosts in Cockpit in a browser window

Click on “Add a new host”.

Add new hosts button in Cockpit in a browser window

Enter the details of the remote computer (an IP address or a host name). A colored highlight appears at the top of the browser to help you identify the computer you are viewing.

Add a new host window in Cockpit in a browser window

Click “Add” when you’re ready. You should now see the remote computer in the list of available hosts; click the drop-down arrow next to it.

New remote computer in the host list in Cockpit in a browser window

Click on the new remote computer to monitor it.

Monitoring the remote host in Cockpit in a browser window

The name of the host you are monitoring is displayed. The color highlight at the top of the browser window will also be the one you selected when you added this host.

Many more features

Cockpit offers you many other features, including:

Get the general health of a computer.
Monitor performance with CPU, memory, disk, and network activity.
Change the host name.
Connect the host to a domain.
Open a terminal window.
Manage software updates, user accounts, services and daemons, partition tables, network links and bridges, and IP addresses.
Create a RAID device.

Other features are also on the way. Developers have a working proof of concept version that shows a combined view of multiple hosts at once. Cockpit is not the most sophisticated management tool, but it is feature rich, simple to use and will meet most needs.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.