The cockpit is a powerful web-based administrative interface that allows to manage and monitor Linux servers spread across the network. With Cockpit, you can have a quick glance at the performance of all your added servers. Also, you can monitor system resources, start and stop services, shut down the system, install updates, view network activity (send/received). create or remove user accounts, access Terminal, and much more on the remote servers.
In an earlier post, we went through the installation of Cockpit on Ubuntu OS. In today’s post, we’re going to show how to install Cockpit on the CentOS system.
Note: The procedure described here has been tested on CentOS 8 system.
Step 1: Installing Cockpit
The cockpit is included in the CentOS default repositories. So in order to install Cockpit on CentOS, you only require to run the command below in your Terminal:
$ sudo yum install cockpit
Enter the sudo password, after which Cockpit should be installed on your system. During installation, if it asks for confirmation, type y and press Enter.
You don’t have to manually start the Cockpit service as it automatically starts after installation. However, in case it is not started, you can manually start it as follows:
$ sudo systemctl start cockpit
To enable the service to automatically start at boot, use the command below:
$ sudo systemctl enable cockpit
To verify if the service is started and running, view the status of cockpit service as follows:
$ sudo systemctl status cockpit
The output below verifies that the Cockpit is active and running.
Step 2: Configuring Firewall
Cockpit’s browser-based interface can be accessed on localhost port 9090. If you need to access the cockpit web interface from other systems, you will need to allow external connections to port 9090 through the firewall.
Use the command below to allow Cockpit’s web interface accessible from other systems.
$ sudo firewall-cmd --permanent --zone=public --add-service=cockpit
Then reload firewall:
$ sudo firewall-cmd --reload
This rule will allow other systems to access the Cockpit web interface.
Step 3: Accessing Cockpit Web Interface
To access the Cockpit web interface, head to https://localhost:9090 in your web browser. To access the web interface from any other system, use https://ip-address:9090, where ip-address is the IP address of the Cockpit server.
After accessing the web interface, you will see a login page. You can log in to Cockpit using the username and password of any local account of your Cockpit server. Once you are logged in, you will see a Dashboard with only one server listed in it which is the Cockpit server itself.
Step 4: Adding Servers for Monitoring
To manage remote servers from Cockpit, you will first need to make sure they have:
- Cockpit installed and running. If the remote machine is CentOS, you can use the steps described above for installing Cockpit. If the remote machine is Ubuntu or Debian, follow this link.
- SSH enabled (Visit how to enable SSH on Ubuntu and CentOS)
- SSH port allowed in the firewall
Now to add remote serves for monitoring, click Add new host from the left panel in the Cockpit web interface. It will open a Add new host window. Here, enter the hostname/IP address and username of the remote system. Then click Add.
Next, you’ll see the below window with your host key fingerprint. Here you are required to verify the host key fingerprint. You can do so by running the command displayed on the screen on your remote system.
Below is the screenshot of the commands I ran on the remote machine.
Compare this fingerprint with your host key fingerprint. If the fingerprint on the remote machine matches with fingerprint on Cockpit server machine, click Accept key and connect, otherwise click Cancel.
Once the host is added, you will see it listed in the let panel of Cockpit’s web interface. Similarly, you can add multiple hosts in the Cockpit for monitoring.
In case, you need to remove Cockpit from your system, you can do so using the command below in the Terminal:
$ sudo yum remove cockpit
Cockpit helps to save a lot of time by letting the administrators manage the remote servers that are spread across the network using a lightweight and intuitive interface. Using the step-by-step procedure described above, you can easily install Cockpit on your CentOS system and manage other Linux servers.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.