How to Install Cockpit on Debian 11 Bullseye

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 Debian 11 Bullseye operating system.

Pre-Install Configuration for Cockpit

By default, Cockpit is in the default repository. However, like most packages in the Debian stable, it soon becomes quite far behind in updates. The tutorial will install Cockpit from the Debian Bullseye Backports repository, which is often more updated than stable without getting into the testing/unstable areas.

The tutorial will also use APT Pinning, so you do not forget to get updates using the standard apt update command and not interfere with existing stable Debian 11 packages by default.

First, open the preferences file as follows:

sudo nano /etc/apt/preferences

Next, copy and paste the following.

Package: *
Pin: release a=bullseye
Pin-Priority: 500

Package: cockpit
Pin: release a=bullseye-backports
Pin-Priority: 1000

Package: *
Pin: release a=bullseye-backports
Pin-Priority: 100

Save the file CTRL+O, then exit CTRL+X.

Summary of what you added.

  • Backports for package cockpit is always used by default.
  • All packages will use Debian 11 Stable by default.
  • Backup will be backports if anything unavailable in stable.

Now, you will need to add either the backports to your /etc/apt/sources.list if not already present

Import Debian 11 “Bullseye” Backports:

echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-free" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free" | sudo tee -a /etc/apt/sources.list

Update your repositories to reflect the new additions.

sudo apt update

At the current time, Cockpit on Debian 11 stable repository is at version 239.

Backports currently has version 256.

Install Cockpit

Now that you have set up a newer source to install Cockpit on your Debian 11 system, execute the following command in your terminal.

sudo apt install cockpit

Example output:

How to Install Cockpit on Debian 11 Bullseye

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

Confirm the version installed by using the apt-cache policy command.

How to Install Cockpit on Debian 11 Bullseye

As above, you installed version 256 from the Bullseye Backports instead of the default version 239 from the default Bullseye repository.

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 Cockpit on Debian 11 Bullseye

Optional – Configure UFW 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.

If you have UFW installed, make sure to allow 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)

Depending on your needs, you may want to further lock it off by allowing individual IP addresses only to that port.

Example:

sudo ufw allow from <IP ADDRESS> to any port 9090

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.

http://server-ip-address:9090

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

How to Install Cockpit on Debian 11 Bullseye

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

How to Install Cockpit on Debian 11 Bullseye

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 Cockpit on Debian 11 Bullseye

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 Cockpit on Debian 11 Bullseye

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 Cockpit on Debian 11 Bullseye

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 Keep Cockpit Updated

Typically, you would need to use separate commands to check for updates from the backports repository. Given that you now use APT pinning, you won’t forget in the future to check for Cockpit updates.

Check for updates for Cockpit as you would for your entire system.

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

Example output:

How to Install Cockpit on Debian 11 Bullseye

TYPE Y then press the ENTER KEY to proceed with the removal of Cockpit.

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 on Debian 11 Bullseye using the Bullseye-Backports repository.

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.



Follow LinuxCapable.com!

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