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.
Main Features of Cockpit:
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.
How to install Cockpit on Ubuntu ?
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.
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.
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
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
3. Access Cockpit Web Interface
In order to access Cockpit, open the following address in your browser:
or to access it from another system, use the hostname or IP address of the system on which Cockpit is installed:
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.
4. Add Servers for Monitoring
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.
To add the secondary server to Cockpit:
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.
How to Uninstall Cockpit from Ubuntu System ?
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
[Need urgent assistance in fixing missing packages on Ubuntu Systems? We are available to help you. ]