Red Hat / CentOS

How to install Cockpit on CentOS 8

Introduction

How to install Cockpit on CentOS 8

Cockpit is a web console with a friendly user interface that allows you to perform administrative tasks on your servers. Also being a web console, it means you can also use it through a mobile device as well.

Cockpit does not require any special configuration and once installed it is ready to use. You can use it to perform different tasks such as monitor your system’s current state, manage services, create accounts and many more.

In this tutorial you will see how to install Cockpit and how to perform some basic tasks with it in centos 8 distribution.

Note: This guide assumes that you have root access to your centos 8 installation.

How to Install CentOS 8

Cockpit Features

Cockpit allows you to perform the following system operations:

  • Service Management – Start, stop, restart, reload, disable, enable, mask e.t.c
  • User Account Management – Add users, delete, Lock, assign Administrator role, set password, force password change, Add Public SSH keys e.t.c.
  • Firewall Management
  • Cockpit Container management
  • SELinux Policy management
  • Journal v2
  • iSCSI Initiator configurations
  • SOS-reporting
  • NFS Client setup
  • Configure OpenConnect VPN Server
  • Privileged Actions – Shutdown, Restart system
  • Join Machine to Domain
  • Hardware Device Management
  • System Updates for dnf, yum, apt hosts
  • Manage the Kubernetes Node

Install Cockpit on CentOS 8

With centos 8 minimal install, cockpit is not installed and you can add it your system by using the command below, which will install cockpit with its required dependencies.

# yum install cockpit -y

or

# dnf install cockpit -y
How to install Cockpit on CentOS 8
Install Cockpit on centos 8

Enable and Start Cockpit service

We must now enable the Cockpit with the following command:

# systemctl enable --now cockpit.socket
How to install Cockpit on CentOS 8
Enable and Start Cockpit service

And start the Cockpit with:

# 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:

# firewall-cmd --permanent --zone=public --add-service=cockpit
# sudo firewall-cmd --reload
How to install Cockpit on CentOS 8
Setting up the firewall cockpit

Verify whether cockpit service is up and running or not, execute the following commands,

# systemctl status cockpit.socket
# ss -tunlp | grep cockpit
# ps auxf|grep cockpit
How to install Cockpit on CentOS 8
Verify whether cockpit service is up and running or not, execute the following commands

Access Cockpit on CentOS 8  system

As we can see in above command’s output that cockpit is listening on tcp port 9090, open your system web browser and type url :

https://<System-IP>:9090

Use the user name which has admin rights, or we can also use the root user’s credentials to login. In case you want to assign admin rights to any local user, execute the following command,

usermod -G wheel jon
How to install Cockpit on CentOS 8
CentOS8 cockpit login screen

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

cockpit dashboard centos8

On the left side, you have few different sections allow you to review:

  • Logs – review system logs and filter them by importance.
  • Networking – Network stats and services.
  • Accounts – create and manage accounts on your system.
  • Services – review and manage services on your system.
  • Applications – review and manage applications on your system.
  • Diagnostic Reports – create system report for diagnostic purposes.
  • Kernel Dump – Enable/disable kdump service and change crash dump location.
  • SELinux – Enforce SELinux policy.
  • Software updates – check for software updates.
  • Subscriptions – check subscription status.
  • Terminal – web based terminal.

We will review each of these sections briefly.

Logs

You can click on each log for more detailed information about the event. Use this section if you want to run debug, review error or alerts. To change the severity of the logs you are reviewing, use the “Severity” drop-down menu.

An overview of the logs page can be seen below:

Logs
Monitor Logs in RHEL-8

Networking

The networking section provides overview of your current networking usage with graphs, and allows you to configure bond, team, bridge and vlans. You can enable/disable the firewall or stop specific rules. In the networking logs. In the last block you can review the networking logs.

Networking
Monitor Network Usage and Traffic

Accounts

The accounts section allows you to manage accounts on your system. When you click on account, you can modify its settings, change passwords, force password change, lock it or change its role.

Accounts
Manage-User-Accounts-in-centos-8

Services

The services section gives you an overview of the services on your system and gives you an easy way to manage them.

Clicking on specific service gives you an overview of its status where you can stop/start, restart, reload, enable/disable that service. You will also see a separate section with that service’s logs:

Services
Manage Services in centos 8

Diagnostic Reports

As the name suggests, you can obtain a diagnostic information about your system. This can help you troubleshoot problems on your system. In order to use this service, you will need to have the sos utility installed.

# yum install sos

Then click on the Generate report button and wait for the information to be collected.

Diagnostic Reports
Diagnostic Reports of centos 8

Kernel Dump

In the Kernel Dump page, you can change the status of the kdump status, change crash dump data location and test the configuration.

Kernel Dump
Kernel Dump

SELinux

In the SELinux section, you can change the enforce status of SELinux with a simple switch and also review any SELinux related alerts.

SELinux
Manage SELinux Policy

Software Updates

The software updates section gives an overview of packages waiting for update. You can also force a manual check for updates and enable automatic updates.

Software Updates
Install Software Updates on centos 8

Terminal

Terminal section gives you what it says – a terminal. You can use this instead of connecting over SSH. It is useful if you need to run few commands within a browser.

Terminal
Cockpit Web Terminal to Manage centos 8

Conclusion

There are many tools that allow us to manage a server more effectively. Cockpit is one of those tools that with a bright and polished graphical interface can perform common tasks and not so common on a Linux server. Thus, in this post, you have learned to install it on CentOS 8. And see some of its modules.

About the author

Avatar

jon snow

Jon is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, and currently a content creator for ERRORHAT who loves working with computers and strongly believes in sharing knowledge.

3 Comments

Click here to post a comment

  • I have installed cockpit in rhel 8 machine, I need to configure notification alert for file system, services(if any stop), network outage.

    any one have idea, how can do that?

  • Hi,
    currently I have an issue with my Centos Cockpit. After configuring my domain with the Cloudflare it seems like there are two major problems – first, I cannot connect to service via domain:9090, I have to directly enter my IP address. Second, after providing user credentials I’m receiving a timeout from cockpit-ws/cockpit-ssh, along with some errors coming from /var/log/messages. I suspect that it might be caused by wrong DNS configuration (same issue as with incoming mails and postfix), unfortunately I was unable to find a solution. Perhaps you could tell me where should I look for the root cause? Regards, J.

    • CloudFlare do not proxy every single port, its just a HTTP-proxy. I’m not going to post a link, so just google this “Identifying network ports compatible with Cloudflare’s proxy”.