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 Fedora 35 Workstation or Server.
Prerequisites
- Recommended OS: Fedora Linux 35.
- User account: A user account with sudo or root access.
Update Operating System
Update your Fedora 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:
sudo whoami
Example output showing sudo status:
[[email protected] ~]$ sudo whoami
root
To set up an existing or new sudo account, visit our tutorial on Adding a User to Sudoers on Fedora.
To use the root account, use the following command with the root password to log in.
su
Install Dependency Required
Before you proceed with the installation, run the following command to install or check that the package dnf-plugins-core is installed on your Fedora desktop.
sudo dnf install dnf-plugins-core -y
By default, this should be installed.
The tutorial will utilize the terminal, which can be found in your show applications menu.
Example:
Install / Enable Cockpit on Fedora
By default, Cockpit is available in Fedora’s default repository. The Fedora Server has Cockpit installed by default unless it was a variant installation by some Cloud providers, for instance, that strip back nearly all packages for a light install, Fedora Workstation does not come with Cockpit installed by default either.
To install Cockpit, execute the following command in your terminal.
sudo dnf install cockpit cockpit-selinux
Type Y, then press the ENTER KEY to proceed and complete the installation.
Note, the SELinux package should be installed as Cockpit for users new to Fedora/RHEL and discover SELinux can often block software that you had no issues running with on, say Ubuntu, Cockpit can make troubleshooting this very easy.
Once installed, by default, the service is not active, so you will need to do a few systemctl commands as follows.
To start Cockpit using the following command.
sudo systemctl start cockpit cockpit.socket
To enable Cockpit on system startup.
sudo systemctl enable cockpit cockpit.socket
Next, verify the status of Cockpit to make sure it is running correctly on your system.
sudo systemctl status cockpit
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
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:
hostname -I
Next, in your browser, type the example address with port 9090 at the end.
http://server-ip-address:9090
When you first try to navigate the Cockpit Web UI, you will come across an alert. This will notify that the connections are not potentially are not private.
Click on the Advanced button, then Accept the Risk and Continue.
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.
A handy feature is that Cockpit makes disabling, enabling, or restarting services very easy, especially for users new to Linux and especially on servers. The Services tab is potentially a good investment in checking out to see what is enabled on your system by default, sometimes depending on the distribution, you can turn certain services off to decrease the load.
Be sure to research the application service before disabling it.
Updates can be automatically set up in the Software Updates tab and check the log file of what was updated cleanly and quickly.
Cockpit has many more tabs and features that can make everyday use of running Fedora on servers and even Workstations easier for users. A good feature is the SELinux tab, and here you can see if any services are being interfered with by SELinux and how to allow or, in other terms, whitelist the application.
For newer users, most recommendations are primarily safe to follow. Still, it does pay to do some research to make sure you are not opening up too many security loopholes and better understand what SELinux is doing.
Also, previous system modifications to SELinux are visible in the automation script, which can be modified anytime. A previous tutorial that was conducted with installing ClamAV on this VM added the “Allow antivirus to can scan system”, Cockpit is great as you can keep an eye on what you have allowed previously and if it is still needed as removing outdated rules is a must for good system security.
Comments and Conclusion
In the tutorial, you have learned how to install or enable Cockpit for Fedora 35 Server or Workstation. Cockpit is a fantastic option for users to maintain their systems efficiently, and 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.