Install and Use Cockpit on AlmaLinux 9 | Best Management Tool

Posted on

Install and Use Cockpit on AlmaLinux 9 | Best Management Tool

Install and Use Cockpit on AlmaLinux 9 | Best Management Tool

In this guide, we will demonstrate how to Install and Use Cockpit on AlmaLinux 9. Cockpit is a powerful and user-friendly server management tool that operates as a plugin for Linux systems. It provides a web-based graphical interface and dashboard, enabling users to efficiently manage their Linux servers. Cockpit is designed to be accessible to both newcomers to Linux and experienced system administrators. It is known for being efficient, lightweight, and easy to use, making server administration tasks simpler and more intuitive. Let’s explore how to Install and Use Cockpit on AlmaLinux 9.

Now, let’s follow the step-by-step instructions provided below to install Cockpit on AlmaLinux 9 and access its comprehensive dashboard.

Before you begin, ensure you have the following prerequisites in place: You must log in to your AlmaLinux 9 server as a non-root user with sudo privileges and have a basic firewall configured. If you haven’t already done so, you can refer to our guide on Initial Server Setup with AlmaLinux 9 for assistance.

1. Install Cockpit on AlmaLinux 9

Cockpit is often pre-installed on AlmaLinux 9, but it might not be enabled by default. The easiest way to check and enable it is with the following command:

sudo systemctl enable --now cockpit.socket

If Cockpit is not already installed on your server, follow the steps outlined below to install it.

First, it’s good practice to update your local package index. This ensures you have the latest information about available packages:

sudo dnf update -y

The Cockpit packages are readily available in the default AlmaLinux repository. To install Cockpit, execute the following command:

sudo dnf install cockpit -y

Start and Enable Cockpit Service

After installation, you need to start the Cockpit service to make it accessible. Use the following command to start the service:

sudo systemctl start cockpit.service

To ensure that Cockpit starts automatically every time your server boots, enable the cockpit.socket service:

sudo systemctl enable cockpit.socket

Now, verify that Cockpit is active and running correctly on your AlmaLinux 9 system by using the following command:

sudo systemctl status cockpit
**Output**
● cockpit.service - Cockpit Web Service
     Loaded: loaded (/usr/lib/systemd/system/cockpit.service; static)
     Active: **active** (**running**) since Thu 2023-02-16 11:57:03 EST; 2s ago
TriggeredBy: ● cockpit.socket
       Docs: man:cockpit-ws(8)
    Process: 72987 ExecStartPre=/usr/libexec/cockpit-certificate-ensure --for-c>
   Main PID: 73000 (cockpit-tls)
      Tasks: 1 (limit: 23609)
     Memory: 676.0K
        CPU: 298ms
     CGroup: /system.slice/cockpit.service
...

A status of "active (running)" confirms that Cockpit is successfully running.

Configure Firewall For Cockpit

Next, you need to configure your firewall to allow access to the Cockpit web interface.

By default, Cockpit listens on port 9090. To allow Cockpit traffic through the firewall, run the following command:

sudo firewall-cmd --permanent --zone=public --add-service=cockpit

Note: Cockpit should have allowed rules if added originally with your AlmaLinux 9 Stream installation by default. If you see the following error, you are safe to move on.

Warning: ALREADY_ENABLED: cockpit

After adding the firewall rule, reload the firewall to apply the changes:

sudo firewall-cmd --reload

2. Access Cockpit Dashboard Web Interface

With Cockpit installed, running, and the firewall configured, you can now access the Cockpit dashboard through your web browser.

Simply type your server’s IP address followed by port 9090 in your web browser’s address bar:

http://<server-ip-address>:9090

You will be presented with the Cockpit login screen. Enter your sudo username or root username and password to log in and proceed to the dashboard.

Cockpit login screen
Cockpit login screen

Once you are logged in, you will see the Cockpit dashboard. The main navigation options are located on the left side of the interface. From here, you can add additional hosts (provided they have SSH connections), view system logs, configure network settings and containers, restart or kill processes, manage services, and much more. It makes it easy to Install and Use Cockpit on AlmaLinux 9.

Cockpit dashboard
Cockpit dashboard

To view your system’s partition information, click on Storage in the left pane. Similarly, you can access network-related information for your AlmaLinux 9 server by clicking on Networking.

Click on Services to see a comprehensive list of all system services and their statuses.

Click on Software Updates to check for and install any available updates for your system.

You can also connect to your server’s command-line interface directly from the Cockpit dashboard by clicking on Terminal.

Conclusion

At this point, you have successfully learned how to Install and Use Cockpit on AlmaLinux 9. Cockpit provides a convenient and efficient way to manage your Linux systems through a web-based graphical interface and dashboard. Its intuitive design and comprehensive features make it an invaluable tool for both novice and experienced system administrators.

Hope you enjoy it. You may also like these articles too:

Set up Siege Stress Tester on AlmaLinux 9

Install Apache Kafka on AlmaLinux 9

Plex Media Server Setup AlmaLinux 9

Almalinux 10 Release Date

Email Server with Sendmail on AlmaLinux 9

Install Cinnamon Desktop on AlmaLinux 9

Restart Network Service on AlmaLinux 9

Alternative Solutions for Server Management on AlmaLinux 9

While Cockpit is a great tool, other options exist for managing your AlmaLinux 9 server. Here are two alternative approaches:

1. Webmin/Virtualmin

Webmin is a web-based system administration tool for Unix-like systems. It allows you to manage users, groups, disk quotas, services, configuration files, shutdown, and more. Virtualmin is a Webmin module that simplifies the management of multiple virtual hosts on a single server, making it suitable for web hosting environments.

Explanation:

Webmin provides a more comprehensive set of features than Cockpit, especially for server configuration. It offers granular control over various aspects of the system. Virtualmin adds the ability to easily manage websites, email accounts, and DNS records.

Installation (Webmin):

First, you need to add the Webmin repository to your system:

sudo tee /etc/yum.repos.d/webmin.repo <<EOL
[Webmin]
name=Webmin Distribution Neutral
#baseurl=https://download.webmin.com/download/yum
mirrorlist=https://download.webmin.com/download/yum/mirrorlist
enabled=1
EOL

Then, import the Webmin GPG key:

wget https://download.webmin.com/jcameron-key.asc
sudo rpm --import jcameron-key.asc

Finally, install Webmin:

sudo dnf install webmin -y

Once installed, you can access Webmin at https://<server-ip-address>:10000. Remember to adjust your firewall to allow traffic on port 10000.

Example Use Case:

Let’s say you want to create a new user account on your server. With Webmin, you can navigate to System -> Users and Groups, and then click "Create a new user". You can then fill in the user’s details, such as username, password, and home directory. This process is significantly simplified compared to using command-line tools.

2. Command-Line Interface (CLI) with SSH

The most fundamental way to manage a Linux server is through the command-line interface (CLI) using SSH. While it requires more technical expertise, it offers the greatest flexibility and control.

Explanation:

Using SSH (Secure Shell) to connect to your server and executing commands directly provides access to all the system’s features and configuration options. This approach is preferred by experienced administrators who are comfortable with command-line tools.

Code Example:

Here’s a simple example of how to update all packages on the system using the CLI:

sudo dnf update -y

This command performs the same function as updating the software through Cockpit or Webmin, but it’s executed directly from the command line.

Example Use Case:

Imagine you need to check the disk space usage on your server. You can use the df -h command:

df -h

This will display a human-readable output of disk space usage for all mounted file systems.

Advantages and Disadvantages:

  • CLI: Provides the most control and flexibility, but requires significant technical knowledge.
  • Webmin/Virtualmin: Offers a user-friendly interface with a wide range of features, but can be overwhelming for beginners.
  • Cockpit: Strikes a balance between ease of use and functionality, but may not offer the same level of control as the CLI or Webmin.

Choosing the right tool depends on your specific needs, technical skills, and preferences. Install and Use Cockpit on AlmaLinux 9 if you are looking for a simple and efficient way to manage your server. If you need more control or manage multiple websites, consider Webmin/Virtualmin or the CLI.

Leave a Reply

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