Cockpit is a server administration tool. Its main purpose is to replace the standard administration GUI of a web hosting company and enable remote administration.

It offers methods not normally available in the Control Panel software, such as access to HTTP requests. With these advanced methods, it is ideal for server-side tasks such as setting up cron jobs or other tasks you need to do via shell script on Unix/Linux servers. In addition, other people (or even your own staff) can easily create their own scripts using one of the supported scripting languages.

When a server is started with Cockpit installed, Cockpit connects to it and waits for incoming connections from the operating system. It provides an interface via WebSockets to send commands to the operating system and real-time monitoring of key statistics provided by chainguards3. It also provides basic chat functions similar to IRC.

You can perform many server administration tasks, such as starting/stopping/restarting services, restarting and shutting down the server. You can also view statistics such as CPU usage, memory usage and available disk space and, more importantly, retrieve troubleshooting information such as Apache access and error logs (assuming the server has such loggers).

In this tutorial we will guide you through the installation and start-up of the Cockpit on a Debian server.

Prerequisites

To follow this tutorial, you will need to have:

  • A Debian 10 or Debian 11 server with root access.
  • Minimum 2 GB of RAM and 15 GB of disk space available. If you have a server with less than 2GB of RAM.

Updating the System

It’s always a good idea to update the system before installing Cockpit. This will prevent any errors during Cockpit installation and ensure that your server has the latest packages.

Run the following command to update your system.

sudo apt-get update && sudo apt-get upgrade -y

Installing Cockpit

Now that the system is up to date, we can start the installation process. One of the easiest ways to install Cockpit is to use the apt package managers.

Run the following command to install Cockpit on your system.

sudo apt install cockpit -y

The command above will download and install the latest version of Cockpit and all its dependencies on your system, but it will not start the Cockpit service yet. Run the following command to start and enable Cockpit at system boot.

sudo systemctl start cockpit && sudo systemctl enable cockpit

Run the command below to check the status of the service.

sudo systemctl status cockpit

You should see something similar to the following output.

<img alt="Cockpit successfully installed" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19709-1.png64269f175034e.jpg" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="255" src="data:image/svg xml,” width=”640″>

Configuring the UFW Firewall

By default, Cockpit uses TCP ports 80 & 9090 to accept connections. If your server is behind a firewall, you must open these ports for incoming connections.

Run the command below to open the required ports using ufw.

sudo ufw allow 80 && sudo ufw allow 9090

Once ufw is configured, you should check the status of the service to ensure that it’s active.

sudo ufw status

Sample output:

<img alt="Firewall Status" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19709-2.png64269f175c47a.jpg" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="173" loading="lazy" src="data:image/svg xml,” width=”634″>

Accessing Cockpit Web UI

Now that the server is configured, the next step is to connect to it using your web browser. Open your favorite web browser and type the IP address of the server followed by 9090 to access Cockpit web UI. We recommend using Google Chrome as it’s fast, secure, and supported by Cockpit.

http://server_ip:9090

For example, if your server is running on a network with an IP address of 192.168.1.105, the URL should be:

http://192.168.1.105:9090

If you don’t know your server’s IP address, you can run the following command below to find out.

Sample output:

<img alt="Get IP address" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19709-3.png64269f1767d09.jpg" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="321" loading="lazy" src="data:image/svg xml,” width=”645″>

You will encounter a warning on your browser telling you that the connection is not private and may be intercepted by third parties. Don’t worry as this is normal as we haven’t yet set up HTTPS for Cockpit.

To overcome this, click on Advanced

<img alt="Self-signed SSL certificate" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19709-4.png64269f1773162.jpg" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="579" loading="lazy" src="data:image/svg xml,” width=”824″>

On the next screen, click on Proceed to (unsafe)

<img alt="Proceed to login" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19709-5.png64269f177d8f1.jpg" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="728" loading="lazy" src="data:image/svg xml,” width=”862″>

You will be taken to the login page. You don’t have to create a separate account to use Cockpit as an administrator. You can use your root credentials to log in. Fill in the necessary credentials and click Log In.

<img alt="Cockpit Login" data-ezsrc="https://vitux.com/wp-content/uploads/word-image-19709-6-1024×614.webp" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="450" loading="lazy" src="data:image/svg xml,” width=”750″>

Once the authorization is successful, you’ll be taken to the Cockpit console.

<img alt="Cockpit GUI" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19709-7.png64269f17dd000.jpg" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="925" loading="lazy" src="data:image/svg xml,” width=”1423″>

The first time you log in to the Cockpit web UI, you should always update it to its latest version. You can do this by clicking on Software Update at the bottom left.

<img alt="Install software updates using Cockpit" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19709-8.png64269f17e9ca6.jpg" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="925" loading="lazy" src="data:image/svg xml,” width=”1423″>

To edit your user’s Cockpit settings, click on your username in the top right. You will be taken to a page where you can change your password and manage other user settings.

<img alt="SSH Keys and Display language" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19709-9.png64269f180089d.jpg" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="218" loading="lazy" src="data:image/svg xml,” width=”468″>

To access your System Dashboard, click on System > Overview. This section provides a high-level overview of your system. From here, you can view and manage packages installed on the machine and services running on your server, monitor network activity and send or receive files from your computer to the server.

<img alt="System overview" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19709-10.png64269f180b573.jpg" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="334" loading="lazy" src="data:image/svg xml,” width=”234″>

Conclusion

Cockpit is a very powerful tool that will allow you to manage remote servers using only a web browser easily. It’s much easier to use than traditional terminal clients such as SSH.

This tutorial taught you how to install and configure Cockpit on Debian Linux. You can now start using the service to manage your server remotely. For more information about Cockpit, visit its official website.