How to Install Cockpit on CentOS 8

install cockpit on centos
Cockpit is a free and open-source web based server management software. It has a pretty web console which allows system administrators to easily perform tasks such as storage administration, network configuration, starting Docker containers, check out the server performance, start and stop services and many other administrative operations. Some of the awesome benefits of Cockpit in our GNU/Linux servers are as follows:

  1. It consists of systemd service manager for ease.
  2. It has a Journal log viewer to perform troubleshoots and log analysis.
  3. Storage setup including LVM was never easier before.
  4. Basic Network configuration can be applied with Cockpit
  5. We can easily add and remove local users and manage multiple servers.

In this tutorial, you will learn how to install the latest version of Cockpit on CentOS 8.

On Centos 8/7 and RHEL 8

Update system packages

Before we install Cockpit packages, we need to update the system:

$ sudo yum -y update
CentOS-8 - AppStream                                        1.7 kB/s | 4.3 kB     00:02    
CentOS-8 - Base                                             1.2 kB/s | 3.8 kB     00:03    
CentOS-8 - Extras                                           1.4 kB/s | 1.5 kB     00:01    
Extra Packages for Enterprise Linux 8 - x86_64               12 kB/s |  32 kB     00:02    
Extra Packages for Enterprise Linux 8 - x86_64               86 kB/s | 1.7 MB     00:20    
Dependencies resolved. 
Nothing to do.
Complete!

Since the Centos 8 was just released, at the time of writing this article, there are no updates yet.

Installing Cockpit packages from repository

In Centos 8, the Cockpit packages are included in the extras repository by default and you can install it right away, unlike with Centos 7 where you needed to add epel repo first. We initiate the Cockpit installation with the following command:

$ sudo yum install cockpit
$ sudo yum install cockpit
Last metadata expiration check: 0:04:25 ago on Thu 26 Sep 2019 03:10:41 PM UTC.
Dependencies resolved.
================================================================================
 Package                               Arch            Version         
================================================================================
Installing:
 cockpit                               x86_64          185.1-1.el8_0            
Installing dependencies:
 PackageKit                            x86_64          1.1.12-2.el8    
 PackageKit-glib                       x86_64          1.1.12-2.el8            
 cairo                                 x86_64          1.15.12-3.el8      
 cairo-gobject                         x86_64          1.15.12-3.el8        
 libX11                                x86_64          1.6.7-1.el8        
 libX11-common                         noarch          1.6.7-1.el8           
 libXau                                x86_64          1.0.8-13.el8         
 libXext                               x86_64          1.3.3-9.el8          
 libXrender                            x86_64          0.9.10-7.el8         
 libxcb                                x86_64          1.13-5.el8              
 pixman                                x86_64          0.36.0-1.el8           
 python3-cairo                         x86_64          1.16.3-6.el8             
 python3-gobject                       x86_64          3.28.3-1.el8             
 python3-systemd                       x86_64          234-8.el8           
 setroubleshoot-plugins                noarch          3.3.10-1.el8        
 checkpolicy                           x86_64          2.8-2.el8                   

.....        

Transaction Summary
================================================================================
Install  42 Packages

Total download size: 16 M
Installed size: 46 M
Is this ok [y/N]: 

Type "y" and it will start downloading and installing the required packages.

On Fedora

Alike, CentOS, it is also available by default in Fedora's official repository, we'll simply install cockpit using dnf package manager.

# dnf install cockpit

On Arch Linux

Cockpit is currently not available in the official repository of Arch Linux but it is available in the Arch User Repository also know as AUR. So, we'll simply run the following yaourt command to install it.

# yaourt cockpit

On Ubuntu

Use apt command to install cockpit on ubuntu or debian

sudo apt update
sudo apt -y install cockpit
sudo systemctl status cockpit

Allow port 9090 on firewall

sudo ufw allow 9090

Enable and Start Cockpit service

We must now enable the Cockpit with the following command:

$ sudo systemctl enable --now cockpit.socket
Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket → /usr/lib/systemd/system/cockpit.socket.

And start the Cockpit with:

$ sudo systemctl start cockpit

Setting up the firewall

Finally, let's make sure the firewall will not block the Cockpit. By default, you shouldn't have any problems reaching Cockpit, but just in case we will open up the required ports using the following commands:

$ sudo firewall-cmd --permanent --zone=public --add-service=cockpit
Warning: ALREADY_ENABLED: cockpit
success

$ sudo firewall-cmd --reload
success

As you can see, the Cockpit was already added to firewall rules. But it is better to run this just in case, and avoid possible problems with the firewall.

The installation of the Cockpit is now complete, you can access the dashboard by navigating to the following URL:

https://localhost:9090

If you have a static IP address, you can type your IP instead "localhost" to access Cockpit from anywhere.

Logging into Cockpit

When navigating to the Cockpit URL, you may be prompted with a security warning about the SSL certificate of the site as it is self-signed. You can ignore the warning and proceed to the login area. Log into the Cockpit using the superuser credentials.

Upon login, you will be greeted by the system info and resource monitor page:

Conclusion

Cockpit is a must have tool for admins and developers alike. Once you start using it, you'll have it installed on all of your Linux servers. As we saw in this tutorial, the Cockpit is one great Linux server management tool. If you have comments and questions, please post them below in the comment section.

Slavisa Milojkovic 10:08 am

Comments

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

All comments are subject to moderation.