How to Install or Enable Cockpit on Ubuntu 20.04

Cockpit is a free remote server manager that is lightweight and easy to use for GNU/Linux servers. Cockpit is a web-based graphical interface for servers intended for people new to Linux to the experts such as sysadmins. Cockpit makes Linux discoverable, allowing anyone using the software to perform tasks such as start containers, administer storage, configure networks, and inspect logs.

In the following tutorial, you will learn how to install Cockpit on your Ubuntu 20.04 LTS Focal Fossa system.


  • Recommended OS: Ubuntu 20.04
  • User account: A user account with sudo or root access.

Update Operating System

Update your Ubuntu operating system to make sure all existing packages are up to date:

sudo apt update && sudo apt upgrade -y

The tutorial will be using the sudo command and assuming you have sudo status.

To verify sudo status on your account:

sudo whoami

Example output showing sudo status:

[joshua@ubuntu ~]$ sudo whoami

To set up an existing or new sudo account, visit our tutorial on How to Add a User to Sudoers on Ubuntu.

To use the root account, use the following command with the root password to log in.


Install Cockpit

By default, Cockpit is in the default App stream repository and, depending on the variation of your installation, should be installed by default. However, the tutorial will run through a complete installation if it is missing or you removed it.

To install Cockpit, execute the following command in your terminal.

sudo apt install cockpit

Example output:

How to Install or Enable Cockpit on Ubuntu 20.04

TYPE Y then press the ENTER KEY to proceed and complete the installation.

Once installed, by default, the service is not active, so you will need to do a few systemctl commands as follows.

To start Cockpit:

sudo systemctl start cockpit.socket

To enable Cockpit on system startup:

sudo systemctl enable cockpit.socket

Next, verify the status of Cockpit to make sure it is running correctly on your system:

sudo systemctl status cockpit.socket

Example output if everything is working correctly:

How to Install or Enable Cockpit on Ubuntu 20.04

Configure Firewall for Cockpit

The next step is to allow through your firewall Cockpit to have access to listen. By default, Cockpit listens on port 9090.

To set this, execute the following command in your terminal.

sudo ufw allow 9090

Example output if successful:

Rules updated
Rules updated (v6)

How to Access Cockpit Web UI

Now that you have confirmed or installed Cockpit, it is time to open it using your favorite Internet Browser.

First, find out your servers IP address:

ip a

Next, in your browser, type the example address with port 9090 at the end.


When you first try to navigate to the Cockpit Web UI, you will come across an alert as follows:

How to Install or Enable Cockpit on Ubuntu 20.04

You will be notified that the connections are not private, click on the Advanced button.

How to Install or Enable Cockpit on Ubuntu 20.04

Accept the Risk and Continue without an SSL to proceed to the Cockpit login.

Next, you will see the Cockpit login, and this is your same sudo username or root username and password—log in to proceed to the dashboard.

How to Install or Enable Cockpit on Ubuntu 20.04

Once logged in, you will see the immediate dashboard. Cockpit’s main options are on the left side, where you can add additional hosts if they have SSH allow connections, view logs, configure network and containers, restart, kill and maintain services and much more.

How to Install or Enable Cockpit on Ubuntu 20.04

As mentioned above, in the middle of the screen, you can monitor memory and CPU usage and see detailed history. One of the main benefits of using Cockpit is having a terminal screen in a Web UI. At the bottom of the page, click Terminal.

How to Install or Enable Cockpit on Ubuntu 20.04

As above, you have a terminal with the power of using a Web-based GUI to assist you in bringing the best of both worlds together.

How to Update Cockpit

To keep Cockpit up to date on Ubuntu 20.04, you just need to make sure you are checking for updates on your system as you should be with the following command.

sudo apt update

And process the upgrades like you would with all other packages.

sudo apt upgrade

How to Remove (Uninstall) Cockpit

For users or administrators that no longer require Cockpit on their systems, run the following command.

sudo apt autoremove cockpit --purge -y

This command will remove Cockpit and all unused dependencies that were initially installed with it.

Comments and Conclusion

In the tutorial, you have learned how to install or enable Cockpit for Ubuntu 20.04 LTS Focal Fossa.

Overall, Cockpit is a fantastic option for users to maintain their systems easily. It is designed for new users with sysadmins in mind and the ability to be operated remotely. If you are getting into Linux, using Cockpit would be a solid option in understanding how the systems work and identifying issues quickly within a few clicks.

To learn more about the benefits and tips and tricks you can achieve with Cockpit, visit the official documentation.


Like to get automatic updates? Follow us on one of our social media accounts!