How to Install Cockpit on Ubuntu 22.04 | 20.04

Cockpit is a powerful, modern, and user-friendly web-based interface that simplifies the administration and management of Linux servers. It allows system administrators to monitor, configure, and troubleshoot their servers with ease. In this introduction, we’ll cover the key features and benefits of Cockpit, as well as the differences between using Cockpit and traditional command-line interfaces.

Key Features and Benefits:

  • Intuitive Web Interface: Cockpit offers a graphical interface that is easy to navigate and understand, even for users with limited experience managing Linux servers.
  • Real-time Monitoring: With Cockpit, you can monitor server performance in real-time, including CPU, memory, and disk usage.
  • Log Management: Cockpit makes it easy to view and filter system logs, enabling you to identify and resolve issues quickly.
  • System Updates: Keep your server up-to-date with the latest security patches and software updates through Cockpit’s straightforward update management.
  • Container Management: Easily manage and monitor Docker containers through the Cockpit interface.
  • Multi-Server Management: Manage multiple servers from a single Cockpit interface, streamlining the administration process.

Differences between Cockpit and Traditional Command-Line Interfaces:

  • Accessibility: Cockpit can be accessed from any device with a web browser, making it a more convenient option than command-line interfaces, which require direct access to the server or an SSH connection.
  • Learning Curve: While command-line interfaces can be intimidating for new users, Cockpit’s graphical interface is more approachable and easier to learn.
  • Centralized Management: Cockpit allows you to manage multiple servers from a single interface, while traditional command-line interfaces would require you to connect to each server individually.
  • User Management: Cockpit simplifies user management with its visual interface, making it easier to add, modify, or remove users and groups.

To summarize, Cockpit offers an accessible, user-friendly solution for managing Linux servers, making it an excellent choice for both new and experienced system administrators. The following guide will demonstrate how to install Cockpit on Ubuntu 22.04 Jammy Jellyfish or Ubuntu 20.04 Focal Fossa.

Section 1: Install Cockpit

In this section, we will walk through the process of installing Cockpit on your Ubuntu system. Following the steps below will ensure a smooth installation and setup of the Cockpit web interface.

Step 1: Update Ubuntu

Before installing Cockpit, it is essential to update your Ubuntu system to ensure you have the latest packages and security updates. This helps minimize potential issues during the installation process. To update your system, open the terminal and execute the following command:

sudo apt update && sudo apt upgrade

Step 2: Install Cockpit

Cockpit is available in the default AppStream repository for Ubuntu, and it might already be installed on your system depending on your installation variation. However, we will walk through the installation process to ensure you have Cockpit set up correctly, even if you removed it previously or it was not installed by default.

To install Cockpit on your system, execute the following command in your terminal:

sudo apt install cockpit

Alternatively, you can enable a third-party repository maintained by ViViD that provides the latest versions for Ubuntu Focal Fossa and Jammy Jellyfish. To install this version, first import the PPA:

sudo add-apt-repository ppa:vivnet/cockpit -y

Now update the packages list to reflect the newly imported PPA with the following command:

sudo apt update

If you have or have not installed Cockpit, run this command as it will upgrade or install the software:

sudo apt install cockpit

Step 3: Start Cockpit Service

After the installation is complete, Cockpit’s service is not active by default. Therefore, you will need to use a few systemctl commands to start and enable Cockpit on your system.

To start the Cockpit service, run the following command:

sudo systemctl start cockpit.socket

Step 4: Enable Cockpit on System Startup

To ensure that Cockpit automatically starts when your system boots up, execute the following command:

sudo systemctl enable cockpit.socket

Step 5: Verify Cockpit Status

Finally, it is essential to verify that Cockpit is running correctly on your system. To check the status of the Cockpit service, use the following command:

systemctl status cockpit.socket

If everything is set up correctly, you should see the service status as active.

Section 2: Configure UFW Firewall for Cockpit

In this section, we will guide you through configuring the UFW (Uncomplicated Firewall) to allow Cockpit access through the firewall. By default, Cockpit listens on port 9090, and we need to make sure that the firewall rules are set to permit incoming connections on this port.

Step 1: Check UFW Status

Before making any changes, it’s essential to check the current status of the UFW firewall. To do so, run the following command:

sudo ufw status

If the firewall is inactive, you will need to enable it before proceeding. To enable UFW, use the following command:

sudo ufw enable

Step 2: Allow Cockpit Through the Firewall

To configure the UFW firewall to allow incoming connections for Cockpit, execute the following command in your terminal:

sudo ufw allow 9090

If the command executes successfully, you should see the following output:

Rules updated
Rules updated (v6)

This output indicates that both IPv4 and IPv6 rules have been updated to allow traffic on port 9090.

Step 3: Verify the Firewall Configuration

It’s essential to verify that the firewall configuration is correct and allows Cockpit access. To check the UFW rules, use the following command:

sudo ufw status

The output should show that port 9090 is open for incoming connections:

Status: active

To                         Action      From
--                         ------      ----
9090                       ALLOW       Anywhere
9090 (v6)                  ALLOW       Anywhere (v6)

With the firewall correctly configured, Cockpit should now be accessible on port 9090, and you can proceed with further setup and configuration tasks.

Section 3: Accessing the Cockpit Web Interface

In this section, we’ll walk you through the process of accessing the Cockpit web interface. Once you’ve successfully installed and configured Cockpit, as well as allowed access through the firewall, you can manage your Linux server via the intuitive web interface.

Step 1: Open Your Web Browser

To access the Cockpit web interface, you’ll need a web browser on any device within the same network as the server running Cockpit. You can use popular web browsers such as Google Chrome, Mozilla Firefox, or Microsoft Edge.

Step 2: Navigate to the Cockpit Web Interface

In the address bar of your web browser, enter the IP address or hostname of the server running Cockpit, followed by the port number on which Cockpit is listening (by default, port 9090). The URL should look like this:


For example, if your server’s IP address is, you would enter:

Step 3: Accept the SSL Warning (Optional)

Since Cockpit uses a self-signed SSL certificate by default, you may encounter a security warning in your web browser. This is normal, and you can safely proceed by accepting the warning and adding an exception for the Cockpit web interface. The steps to do this vary depending on the web browser you are using.

Note: For production environments, it is recommended to configure Cockpit with a valid SSL certificate from a trusted Certificate Authority (CA). This will prevent security warnings and ensure a secure connection to the web interface.

Step 4: Log In to Cockpit

After navigating to the Cockpit web interface and accepting the SSL warning (if necessary), you should see the login screen. Use your server’s system credentials (username and password) to log in. These are the same credentials you use when logging in via SSH or the local console.

Once you’ve successfully logged in, you will be presented with the Cockpit dashboard. From here, you can monitor, manage, and configure various aspects of your Linux server through the user-friendly web interface.

Section 4: Tips on Getting Started with Cockpit with Ubuntu Linux

In this section, we will provide you with some tips and tricks to help you make the most of your experience with Cockpit on Ubuntu Linux. These suggestions cover various aspects of Cockpit, from customizations to general tips.

General Tips

  • Keep Your System Up-to-Date: Regularly update your Ubuntu system to ensure you have the latest packages and security updates. This will minimize potential issues and help you stay on top of new features and improvements.
  • Explore Available Modules: Cockpit offers numerous modules to help manage different aspects of your Linux server. Some modules may not be installed by default, but you can easily install them using the package manager. Examples include cockpit-docker for managing Docker containers and cockpit-machines for managing virtual machines.
  • Use the Terminal in Cockpit: Cockpit includes a built-in terminal that allows you to execute commands directly within the web interface. This can be a convenient way to perform tasks on your server without having to switch between the web interface and a separate terminal or SSH session.


  • Change the Listening Port: By default, Cockpit listens on port 9090. If you prefer to use a different port, edit the /lib/systemd/system/cockpit.socket file and change the ListenStream value to the desired port number. After making the change, restart the cockpit.socket service.
  • Configure SSL Certificates: Cockpit uses a self-signed SSL certificate by default, which can result in security warnings in web browsers. To avoid this, you can configure Cockpit to use a valid SSL certificate from a trusted Certificate Authority (CA).

Other Tips

  • Monitor System Performance: Use Cockpit’s built-in system monitoring features to keep an eye on your server’s resource usage, such as CPU, memory, and network activity. This can help you identify potential bottlenecks and optimize your server for better performance.
  • Manage User Accounts: With Cockpit, you can easily create, modify, and delete user accounts on your Linux server. Use the Accounts module to manage users and their privileges, making user administration simple and efficient.
  • Configure Storage: Cockpit offers a powerful storage management interface that allows you to create and manage logical volumes, RAID arrays, and iSCSI targets. Use the Storage module to keep your data organized and secure.
  • Backup Your Configuration: Before making significant changes to your server’s configuration using Cockpit, ensure you have a backup of your configuration files. This will allow you to quickly revert any changes if needed.

These tips should help you get started with Cockpit on Ubuntu Linux and enable you to take full advantage of its powerful features. Remember to explore the various modules and settings and customize Cockpit to suit your server management needs.

Section 5: Additional Cockpit Commands for Ubuntu Linux

Updating Cockpit on Ubuntu Linux

To ensure that Cockpit stays up to date on your Ubuntu 20.04 system, you should regularly check for updates. This is crucial for maintaining the security and stability of your server. To check for updates, execute the following command in your terminal:

sudo apt update

After fetching the updates, you can upgrade your system packages, including Cockpit, by running:

sudo apt upgrade

This command will upgrade all the available packages, keeping your Cockpit installation up to date alongside other system packages.

Removing (Uninstalling) Cockpit on Ubuntu Linux

If you find that you no longer require Cockpit on your system, you can easily remove it by executing the following command:

sudo apt remove cockpit

This command will uninstall Cockpit and all its unused dependencies that were initially installed with it. It is essential to remove unused software to maintain a clean and secure system environment.

For PPA installations, remember to remove the PPA with the following command:

sudo add-apt-repository --remove ppa:vivnet/cockpit -y

Closing Thoughts on Installing Cockpit on Ubuntu Linux

In conclusion, installing and configuring Cockpit on Ubuntu Linux is a straightforward process that allows you to manage your system efficiently through a web-based interface. We have covered the necessary steps to update your system, install Cockpit, configure the firewall, and access the web interface. With these steps, you are well on your way to harnessing the power of Cockpit to manage your Ubuntu Linux system effectively. Remember, practice makes perfect, so don’t hesitate to dive in and explore the features that Cockpit has to offer.

Additional Resources and Links

As you continue working with Cockpit on Ubuntu Linux, you may find the following resources helpful in expanding your knowledge and enhancing your experience:

  • Cockpit Official Website: The official website of the Cockpit project, where you can find the latest news, updates, and general information about the software.
  • Cockpit GitHub Repository: The official GitHub repository of the Cockpit project, where you can access the source code, report issues, or contribute to the project.
  • Cockpit Documentation: The official documentation of Cockpit, where you can learn more about the features, configuration, and usage of this powerful web-based management tool.

Share to...