Cockpit is a free remote server manager that is lightweight and easy to use for GNU/Linux servers. Cockpit is a web-based graphical interface for servers intended for people new to Linux to the experts such as sysadmins. Cockpit makes Linux discoverable, allowing anyone using the software to perform tasks such as start containers, administer storage, configure networks, and inspect logs.
In the following tutorial, you will learn how to install or enable Cockpit on CentOS 8 Stream.
- Recommended OS: Any current CentOS 8 Stream.
- User account: root access
Updating Operating System
Update your CentOS Stream operating system to make sure all existing packages are up to date:
sudo dnf upgrade --refresh -y
The tutorial will be using the sudo command and assuming you have sudo status.
To verify sudo status on your account:
Example output showing sudo status:
[joshua@centos-stream ~]$ sudo whoami root
To set up an existing or new sudo account, visit our tutorial on adding a User to Sudoers on CentOS Stream.
To use the root account, use the following command with the root password to log in.
The tutorial will utilize the terminal, which can be found in your show applications menu.
Install / Enable Cockpit
By default, Cockpit is in the default App stream repository and, depending on the variation of your installation, should be installed by default. However, the tutorial will run through a complete installation if it is missing or you removed it.
To install Cockpit, execute the following command in your terminal.
sudo dnf install cockpit -y
Once installed, by default, the service is not active, so you will need to do a few systemctl commands as follows.
To start Cockpit:
sudo systemctl start cockpit
To enable Cockpit on system startup:
sudo systemctl enable cockpit.socket
Next, verify the status of Cockpit to make sure it is running correctly on your CentOS 8 Stream system:
sudo systemctl status cockpit
Example output if everything is working correctly:
Configure Firewall for Cockpit
The next step is to allow your firewall Cockpit access to listen. By default, Cockpit listens on port 9090.
To set this, execute the following command in your terminal.
sudo firewall-cmd --permanent --zone=public --add-service=cockpit
Now reload the firewall to make the changes effective immediately.
sudo firewall-cmd --reload
Cockpit should have allowed rules if added originally with your CentOS 8 Stream installation by default. If you see the following error, you are safe to move on.
Warning: ALREADY_ENABLED: cockpit
How to Access Cockpit Web UI
Now that you have confirmed or installed Cockpit, it is time to open it using your favorite Internet Browser.
First, find out your servers IP address:
Next, in your browser, type the example address with port 9090 at the end.
When you first try to navigate the Cockpit Web UI, you will come across an alert as follows.
You will be notified that the connections are not private, click on the Advanced button.
Accept the Risk and Continue without an SSL to proceed to the Cockpit login.
Next, you will see the Cockpit login, and this is your same sudo username or root username and password—log in to proceed to the dashboard.
Once logged in, you will see the immediate dashboard. Cockpit’s main options are on the left side, where you can add additional hosts if they have SSH allow connections, view logs, configure network and containers, restart, kill and maintain services and much more.
As mentioned above, in the middle of the screen, you can monitor memory and CPU usage and see detailed history. One of the main benefits of using Cockpit is having a terminal screen in a Web UI. At the bottom of the page, click Terminal.
As above, you have a terminal with the power of using a Web-based GUI to assist you in bringing the best of both worlds together.
Comments and Conclusion
In the tutorial, you have learned how to install or enable Cockpit for CentOS 8 Stream. Overall, Cockpit is a fantastic option for users to maintain their systems easily. It is designed for new users with sysadmins in mind and can be operated remotely. If you are getting into Linux, using Cockpit would be a solid option in understanding how the systems work and identifying issues quickly within a few clicks.