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 software, 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.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Ubuntu systems related Installation tasks.
In this context, we shall look into how to install Cockpit on the Ubuntu system.
1. Monitor various performance metrics with graphs (CPU, memory, disk IO, network traffics)
2. Inspect system logs
3. Configure and manage storage (view statistics and logs, create RAID, LVM)
4. Monitor and manage networking activity (view sent and received traffic statistics, add VLAN, bonds, bridges )
5. View and manage user accounts
6. View and manage system services
7. View, and manage add-ons
8. Check for and install available updates
9. Use a fully functional in-browser terminal to have more granular control over a system.
Here, 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.
You should be a root sudo user if you need to install / remove a package on the Ubuntu system.
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.
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
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
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
Here, 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.
Now you can add secondary servers for monitoring in Cockpit. The servers you want to monitor should have:
i. 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 .
ii. An SSH server available and running on port 22 as Cockpit uses SSH to log in to secondary servers.
iii. Port 22 allowed in the firewall.
i. Open the Dashboard from the left pane.
ii. Then click the plus (+) icon.
iii. The dialog "Add Machine to Dashboard" will appear.
iv. Type the IP address or the hostname of the secondary server and hit Add button.
v. When the following dialog shows up, click Connect.
vi. 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.
vii. Now you can configure and control all your Linux machines from one single interface.
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
This article covers how to install Cockpit on Ubuntu 20.04 system. Cockpit is a free and open source web console tool for Linux administrators and used for day to day administrative and operations tasks.
To Install the Cockpit package on Ubuntu 20.04 LTS Server, run the command:
$ sudo apt update
$ sudo apt install cockpit -y
Once cockpit package is installed successfully then start its service using the following systemctl command,
$ sudo systemctl start cockpit
Run the following to verify the status of cockpit service,
$ sudo systemctl status cockpit
Features of Cockpit:
Cockpit allows you to perform:
1. Service Management – Start, stop, restart, reload, disable, enable, mask e.t.c
2. User Account Management – Add users, delete, Lock, assign Administrator role, set password, force password change, Add Public SSH keys e.t.c.
3. Firewall Management
4. Cockpit Container management
5. SELinux Policy management
6. Journal v2
7. iSCSI Initiator configurations
8. SOS-reporting
9. NFS Client setup
10. Configure OpenConnect VPN Server
11. Privileged Actions – Shutdown, Restart system
12. Join Machine to Domain
13. Hardware Device Management
14. System Updates for dnf, yum, apt hosts
15. Manage the Kubernetes Node