Tutorial Dedicated Server Hosting

How to Install and Use Cockpit on Ubuntu 20.04

Updated 4 min read

The Cockpit is a web-based tool that helps system administrators perform day-to-day administrative tasks from a web browser. You can monitor system resources, create and remove user accounts, start and stop services, restart and shut down the system, and create and manage virtual boxes using the Cockpit. Cockpit makes it easier to administer your Linux server via a web-based interface.

Step 1 – Install Cockpit

By default, the Cockpit package is included in the Ubuntu default repository. You can install it by just running the following command:

apt-get update -y
apt-get install cockpit -y

Once the Cockpit is installed, start the Cockpit service and enable it to start at system reboot:

systemctl start cockpit
systemctl enable cockpit

You can also verify the status of the Cockpit service with the following command:

systemctl status cockpit

You should get the following output:

cockpit.service - Cockpit Web Service
Loaded: loaded (/lib/systemd/system/cockpit.service; static; vendor preset>
Active: active (running) since Fri 2021-01-22 15:26:48 UTC; 4s ago
TriggeredBy: ● cockpit.socket
Docs: man:cockpit-ws(8)
Process: 7544 ExecStartPre=/usr/sbin/remotectl certificate --ensure --user=>
Main PID: 7552 (cockpit-tls)
Tasks: 1 (limit: 2353)
Memory: 2.0M
CGroup: /system.slice/cockpit.service
└─7552 /usr/lib/cockpit/cockpit-tls

Jan 22 15:26:48 ubuntu2004 systemd[1]: Starting Cockpit Web Service...
Jan 22 15:26:48 ubuntu2004 remotectl[7544]: Generating temporary certificate us>
Jan 22 15:26:48 ubuntu2004 remotectl[7544]: Error generating temporary dummy ce>
Jan 22 15:26:48 ubuntu2004 remotectl[7544]: Generating temporary certificate us>
Jan 22 15:26:48 ubuntu2004 systemd[1]: Started Cockpit Web Service.

At this point, Cockpit is started and listening on port 9090. You can verify it with the following command:

ss -antpl | grep 9090

You should see the following output:

LISTEN 0 4096 *:9090 *:* users:(("cockpit-
tls",pid=7552,fd=3),("systemd",pid=1,fd=101))

Step 2 – Access Cockpit Web Interface

Now, open your web browser and access the Cockpit web interface using the URL https://your-server-ip:9090. You should see the Cockpit login page:

Cockpit login page with username and password fields for Ubuntu 20.04 LTS

Provide your root username and password and click on the Log in button. You should see the Cockpit dashboard in the following page:

Cockpit Overview dashboard showing system health, usage and configuration details

Step 3 – How to Use Cockpit

You can also create and manage the virtual machine using Cockpit.

First, you will need to enable the virtual machine option in Cockpit. You can enable it with the following command:

apt-get install cockpit-machines -y

Once installed, log out and log in again, you should see the Virtual machine option in the following page:

Cockpit Virtual Machines page showing no VMs running or defined on the host

Click on the Create VM button to create a virtual machine. You should see the following page:

Cockpit Create New Virtual Machine dialog with name, OS and memory fields filled in

Provide your VM name, operating system, RAM, and Disk and click on the Create button. Once the VM is created, you should see the following page:

Cockpit Virtual Machines page showing the new VM created and shut off

Next, click on the Console tab, you should see the following page:

Cockpit Virtual Machines Console tab prompting to start the virtual machine

Click on the Run button to start the Virtual Machine. Once the VM is started, you should see the Virtual Machine login screen in the following page:

Cockpit Virtual Machines Console tab showing the VM login prompt after starting

You can now login to VM using your root username and password.

Step 4 – Manage Services and Logs

You can manage the system services and logs from the Cockpit web interface. In the Cockpit web interface, click on the Services button. You should see all system services in the following page:

Cockpit Services page listing system services with their state and startup type

From here, you can start, stop and disable the system services easily.

Click on the Logs button in the left pane and you should see all system logs in the following page:

Cockpit Logs page listing system log entries by date and service

If you want to access your server via terminal, click on the Terminal button. You should see the terminal windows in the following screen:

Cockpit Terminal page showing an open shell session on the server

Conclusion

Congratulations! You have successfully installed Cockpit on Ubuntu 20.04. You can now easily manage your server from its web-based interface. You can also use Cockpit on a dedicated server from Atlantic.Net!

Share

Written by

View all articles →

Ready to Deploy?

Launch secure, compliant, enterprise-grade infrastructure with confidence.