Ubuntu

How to Install Cockpit on Ubuntu 20.04

Install-Cockpit-Ubuntu-20-04

Cockpit is an open-source browser-based utility that allows administering and configuring local and remote multiple servers. It allows to graphically administer several Linux systems at a time. Using its user-friendly browser-based console, you can easily monitor system resources, install softwares, manage users, perform system and security updates, reboot, or power off systems. It provides a dashboard with graphs that shows the status and statistics of several systems at a time. Cockpit is available for many Linux distributions.

With Cockpit, you can:

  • Monitor various performance metrics with graphs (CPU, memory, disk IO, network traffics)
  • Inspect system logs
  • Configure and manage storage (view statistics and logs, create RAID, LVM)
  • Monitor and manage networking activity (view sent and received traffic statistics, add VLAN, bonds, bridges )
  • View and manage user accounts
  • View and manage system services
  • View, and manage add-ons
  • Check for and install available updates
  • Use a fully functional in-browser terminal to have more granular control over a system.

In this guide, we will be going to explain how to install Cockpit on the Ubuntu system. We will need to install the Cockpit package on both the monitoring server (primary server) and those servers (secondary servers) which you want to monitor using Cockpit. For demonstration purposes, we will be using two Ubuntu machines: one for the primary server and the other for the secondary server.

Note: The installation method explained here has been tested on Ubuntu 20.04 LTS system. You should be a root sudo user if you need to install/remove a package on the Ubuntu system.

Step 1: Install Cockpit on Ubuntu

Cockpit is available for installation in the default Ubuntu repositories. You can simply install it through the apt package management utility. Open the Terminal in Ubuntu using the Ctrl+Alt+T shortcut. Then in the Terminal, execute the below command to install Cockpit:

$ sudo apt-get install cockpit

Enter sudo password. Now it will prompt you with Y/n choice. Press Y to proceed with the installation of Cockpit.

install cockpit

Cockpit uses a systemd socket which automatically gets enabled and started after the installation of Cockpit, However, if it does not start automatically, you can enable and start it by executing the following command in Terminal:

$ sudo systemctl enable --now cockpit.socket
$ sudo systemctl start cockpit.socket

Step 2: Configure Firewall

Cockpit is a browser-based interface that can be accessed on TCP port 9090. To allow external connections to port 9090, you will need to allow port 9090 in the firewall. Execute the below command to do so:

$ sudo ufw allow 9090

Step 3: Access Cockpit Web Interface

In order to access Cockpit, open the following address in your browser:

http://localhost:9090

or to access it from another system, use the hostname or IP address of the system on which Cockpit is installed:

http://hostname-or-ip-address:9090

cockpit web interface

Enter your user name and password to login to Cockpit. You can use the same user credentials you use to directly log into the server. Also, check the box Reuse My Password for Remote Connections.

Once you are logged in to the Cockpit web interface, you will see one server in the Dashboard. This server is the one on which Cockpit is installed.

Step 4: Add Servers for Monitoring

Now you can add secondary servers for monitoring in Cockpit. The servers you want to monitor should have:

  • Cockpit installed and running. If the secondary server is Ubuntu, you can install Cockpit in the same way as described above. For other distributions, follow instructions in the Cockpit official guide.
  • An SSH server available and running on port 22 as Cockpit uses SSH to log in to secondary servers.
  • Port 22 allowed in the firewall

To add the secondary server to Cockpit, open the Dashboard from the left pane. Then click the plus (+) icon as shown here in the following screenshot.

add servers in cockpit

The following dialog “Add Machine to Dashboard” will appear. Type the IP address or the hostname of the secondary server and hit Add button.

When the following dialog shows up, click Connect.

Type the User name and password of the secondary server and then click Log In. Remember; the logged-in user will have the same permissions as the user would have if it logs in to the server through SSH.

Once it verifies the credentials, the system will be added to the servers list in the Dashboard. Similarly, add all the servers in your network for monitoring.

cockpit dashboard

Now you can configure and control all your Linux machines from one single interface.

Uninstalling Cockpit

If you no longer require Cockpit on your Ubuntu system, you can easily uninstall it using this command in Terminal:

$ sudo apt-get install cockpit

Enter sudo password. Now it will prompt you with Y/n choice. Press Y if you want to remove Cockpit from your system.

When you install Cockpit, some dependencies are automatically installed. If you want to uninstall them too, the command is as follows:

$ sudo apt autoremove

In this guide, we have covered how to install Cockpit on Ubuntu 20.04 system. Now from a single interface, you can control and manage several systems tasks across the network and save a lot of time.

Similar Posts