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.
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
- 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
# dnf install cockpit -y
Enable and Start Cockpit service
We must now enable the Cockpit with the following command:
# systemctl enable --now cockpit.socket
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
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
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 :
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
Upon login, you will be greeted by the system info and resource monitor page:
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.
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:
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.
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.
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:
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.
In the Kernel Dump page, you can change the status of the kdump status, change crash dump data location and test the configuration.
In the SELinux section, you can change the enforce status of SELinux with a simple switch and also review any SELinux related alerts.
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.
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.
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.