Home Linux DistributionsArch Linux Monitor And Administer Linux Servers Using Cockpit Via Web Browser
Monitor And Administer Linux Servers Using Cockpit Via Web Browser

Monitor And Administer Linux Servers Using Cockpit Via Web Browser

By sk
468 Views

Cockpit is a free, open source, server administration tool that allows you to easily monitor and administer Linux servers via a web browser. It helps the system admins to perform simple administration tasks, such as managing users, starting containers, administrating storage, configuring network, inspecting logs and so on. Switching between Terminal and Cockpit web interface is no big deal. You can the manage the system's services either from the Cockpit, or from the host's Terminal.

Cockpit also has an embedded terminal. Say for example, if you've started a service in Terminal, you can stop it from the Cockpit. Similarly, if an error occurs in the terminal, it can be seen in the Cockpit journal interface and vice versa. It is capable of monitoring multiple Linux servers at the same time. All you need to do is just add the systems that you wanted to monitor and Cockpit will look after them.

In this guide, we will see how to install and configure Cockpit on Linux (RPM and DEB based systems).

Install Cockpit In Linux

Cockpit is originally developed for RPM based systems such as RHEL, CentOS and Fedora. It has been now ported to other Linux distributions such as Arch Linux, Debian and Ubuntu.

Install Cockpit On Arch Linux

Cockpit is available in the official repositories of Arch Linux. To install Cockpit on Arch Linux and its derivatives like Manjaro Linux, run:

$ sudo pacman -S cockpit

Additionally, you should install "cockpit-machines" package, which enables managing virtual machines from the web browser.

$ sudo pacman -S cockpit-machines

After installing it, start and enable cockpit service using command:

$ sudo systemctl enable --now cockpit.socket

Install Cockpit On CentOS

Cockpit is available in the default repositories of CentOS 7. So, you can install it using command:

$ sudo yum install cockpit cockpit-machines

On CentOS 8:

$ sudo dnf install cockpit cockpit-machines

After installing it, start cockpit service using command:

$ sudo systemctl enable --now cockpit.socket

If you want to access the Cockpit web dashboard from other remote systems, you need to allow Cockpit service through firewall. To do so, run:

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

Install Cockpit On Fedora

Cockpit comes pre-installed in Fedora server. If it is not installed by any chance, install Cockpit on Fedora using command:

$ sudo dnf install cockpit cockpit-machines

After installing it, start cockpit service using command:

$ sudo systemctl enable --now cockpit.socket

If you want to access the Cockpit web dashboard, you need to allow Cockpit service through firewall. To do so, run:

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

Install Cockpit On RHEL

In Red Hat Enterprise Linux (RHEL) systems, make sure you have enabled [Extras] repository:

$ sudo subscription-manager repos --enable rhel-7-server-extras-rpms

Then, install Cockpit using command:

$ sudo yum install cockpit cockpit-machines

On RHEL 8:

$ sudo dnf install cockpit cockpit-machines

After installing it, start cockpit service using command:

$ sudo systemctl enable --now cockpit.socket

If you want to access the Cockpit web dashboard, you need to allow Cockpit service through firewall. To do so, run:

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

Install Cockpit On Debian

Cockpit is available in unstable and in backports for Debian 8 (Jessie) and Debian 9 (Stretch).

For Debian 9, enable the [backports] repository as root user like below:

# echo 'deb http://deb.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/backports.list

For Debian 8, enable the backports-sloppy repository:

# echo 'deb http://deb.debian.org/debian jessie-backports-sloppy main' > /etc/apt/sources.list.d/backports.list

Finally, install cockpit using command:

# apt-get update
# apt-get install cockpit cockpit-machines

Install Cockpit On Ubuntu

Cockpit is available in Ubuntu 17.04 and later, so you can install it using command:

$ sudo apt-get install cockpit cockpit-machines

Cockpit is available as an official backport for 16.04 LTS and later. Backports are enabled by default, but if you customized apt sources you might need to enable them manually.

After enabling backports, run the following command to install Cockpit on Ubuntu 16.04:

$ sudo apt-get install cockpit cockpit-machines

There is also an official PPA available for Cockpit for older Ubuntu versions. Add the PPA and install Cockpit as shown below.

$ sudo add-apt-repository ppa:cockpit-project/cockpit
$ sudo apt-get update
$ sudo apt-get install cockpit cockpit-machines

Monitor And Administer Linux Servers Using Cockpit Via Web Browser

Once installed, open your web browser and navigate to https://localhost:9090 (or) https://IP-address:9090. You will be pleased with Cockpit's login screen.

Cockpit Login Interface On Ubuntu 20.04 LTS Server:

Cockpit Login Interface On Ubuntu 20.04 LTS

Use any one of your system user's credentials to login.

Make sure you have checked the box that says - Reuse my password for privileged tasks to perform administrative tasks right from the Cockpit dashboard. If you don't select this option, you may need to enter the password each time when running administrative tasks.

Cockpit Login Interface On CentOS 8 Server:

Cockpit Login Interface On CentOS 8 Server

This is how my Cockpit's dashboard looks like in CentOS 8 server:

Cockpit dashboard in CentOS 8 server

As you see in the above screenshot, Cockpit's System information screen shows your server details, and graphs for CPU, Memory, Disk and network traffic. From this section, you can monitor your server's CPU usage, Memory and Swap usage, Disk usage and live network traffic. You can even update your server from here or restart it.

Here is how Cockpit dashboard looks like in Ubuntu 20.04 LTS:

Cockpit dashboard in Ubuntu 20.04 server

Logs section

Logs section displays the list of errors, warnings, and other important log details of your Linux server.

Logs section in Cockpit

Storage section

This section shows the no of available hard drives, filesystem details, storage logs and disk Read and Write usage.

Storage Section in Cockpit

Networking section

This section displays the list of available network interfaces and the IP address of each card. This is where we configure network settings such as creating Vlan, network bond and network bridge etc. In this section, we can also review the networking logs, incoming and outgoing traffic of the network interface card and the sending & receiving visual graphs.

Networking section in Cockpit

Accounts section

In this section, you can create new users, delete existing users, change user's password etc.

Accounts section in Cockpit

We can also disconnect any SSH sessions from here as well.

Services section

This section displays the list of active and inactive services.

Services section in Cockpit

Cockpit Terminal

Another notable feature of Cockpit web console is it has a built-in Terminal, which allows you to perform all sort of command line operations. You don't need to SSH to your server or don't need to install any remote communication tools. We can use the Cockpit Terminal to perform all command line operations as the way we do in the normal Terminal in the host.

Cockpit Terminal

How to add new hosts in Cockpit dashboard

Cockpit can be able to manage multiple servers at the same time.

Log in to the Cockpit web dashboard.

If you are on Ubuntu, make sure you've checked the option that says "Reuse my password for privileged tasks" under the password field. This allows you to run any administrative actions via Cockpit. If you don't check this option, you can't add any remote systems to your cockpit's dashboard or can't perform any administrative operations. In RHEL, CentOS systems, you can directly login as root user, so you don't have to check this option.

Login as admin user in Cockpit in Ubuntu

Click on the "Dashboard" button from the left pane to view the list of servers managed by Cockpit. You will see the all servers under "Servers" tab.

To add a new server, click on the + (plus) sign in the Servers tab.

View all linux systems managed by Cockpit

Enter the IP address of your remote server that you want to monitor and click Add.

Add new machine to Cockpit dashboard

You will see an unknown host key warning message. Just click Connect button to add the machine anyway.

Connect remote Linux machines to Cockpit

Enter your remote system's username and password.

Enter login details of remote system to add it to Cockpit

Congratulations! We have successfully added a new Linux remote system to the Cockpit dashboard. You will see the newly added systems under Servers tab in Dashboard.

New Linux host is added to Cockpit

Click on the remote system's name to start monitoring it from your Cockpit dashboard.

Monitor remote Linux system from Cockpit

Here, I am monitoring CentOS 8 server from Ubuntu 20.04 LTS server using Cockpit.

Similarly, you can add as many systems as you want to monitor and administer. Once you have gained the control over a remote system, you can completely administer it from your local system via cockpit. Further more, you can add, delete and manage users, add, remove, configure applications via Cockpit Terminal, reboot or shutdown the remote systems.


Recommended read:


Cockpit is opt for budding and seasoned Linux administrators. Cockpit installation and usage is fairly simple and straight forward. If you have a network full of remote systems, add all of them to cockpit dashboard and manage them like a pro.

Resources:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

2 comments

G May 9, 2019 - 2:52 pm

How many hosts we can monitor or add ?

Reply
sk May 9, 2019 - 4:52 pm

There is no limit. You can add as many systems as you want to monitor and administer.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More