1. Home
  2. Linux

How to install Cockpit on Linux

Cockpit is Redhat’s web-based server management system. The primary goal of the project is to offer Linux system administrators the ability to manage their servers quickly and efficiently easily. Officially, Cockpit is offered up as an exciting feature for Fedora Linux, and other RedHat-based Linux server distributions. However, it’s also possible to use Cockpit on Linux server distributions like Debian, Ubuntu and even servers running Arch Linux!

In this guide, we’re going to take the mystery out of setting up the Cockpit interface on Linux. We’ll also go over how to use and manage your system within the interface.

Note: Cockpit’s software is Linux. With that said, you will not need to use it to access the web interface. It’ll run on any operating system, so long as you use Opera, Firefox, Chrome, Microsoft Edge or Safari!

Ubuntu instructions

Looking to use the Cockpit UI on your Ubuntu machine? Lucky for you, there’s no hard work needed to get it working. Ever since version 17.04 of the OS, Cockpitcan be installed with a simple Apt install command.

To get it going on your Ubuntu setup, launch a terminal window and enter the following Apt command below.

sudo apt install cockpit

Debian instructions

The Cockpit project has excellent support for Debian. Officially, the software supports Debian 9 as well as Debian 8. Support for the Cockpit dashboard on Debian Linux is made possible with the Backports software repository for Debian. Without Debian Backports, Cockpit wouldn’t be able to run due to old packages.

To enable Backports, launch a terminal and enter the command below. Alternatively, if you need more guidance in setting Backports up, follow our in-depth tutorial on the subject.

Debian 9

su -

echo 'deb http://deb.debian.org/debian stretch-backports main' > \
/etc/apt/sources.list.d/backports.list

Debian 8

su -

echo 'deb http://deb.debian.org/debian jessie-backports-sloppy main' > \
/etc/apt/sources.list.d/backports.list

With the Backports software sources up and running on your Debian system, you’ll need to run the update command.

sudo apt-get update

Finally, install the Cockpit program on Debian with the following apt-get install command below.

sudo apt-get install cockpit

Arch Linux instructions

While it seems a bit absurd on its face, many Linux users love to use Arch Linux as a server operating system. If you’re one of these people, you’ll be happy to know that it’s possible to run the Cockpit management UI on it. Though, keep in mind that this is an unofficial package not supported by the project.

To get the Cockpit UI up and running on Arch Linux, you won’t be able to run a quick Pacman command. Instead, you’ll need to download and compile the Cockpit AUR package manually. Here’s how to do it.

Start by installing the Base-devel and Git packages via Pacman. This will allow you to work with AUR packages manually easily.

sudo pacman -S base-devel git

Next, grab the Cockpit AUR package using the git clone command.

git clone https://aur.archlinux.org/cockpit.git

Move the terminal into the “cockpit” folder using the CD command.

cd cockpit

Download the AUR dependencies for Cockpit with git.

git clone https://aur.archlinux.org/systemtap.git
git clone https://aur.archlinux.org/pcp.git
git clone https://aur.archlinux.org/python2-pyscss.git
git clone https://aur.archlinux.org/perl-javascript-minifier-xs.git

Build and install the dependencies for Cockpit using makepkg. Keep in mind that if you run into PGP issues, you can skip the check (at your own risk) with--skipinteg.

sudo groupadd -r stapusr ; sudo groupadd -r stapsys ; sudo groupadd -r stapdev
cd systemtap

makepkg -sri

cd ..

cd pcp

makepkg -sri

cd python2-pyscss

makepkg -sri

..

cd perl-javascript-minifier-xs 

makepkg -sri

..

Finally, install Cockpit on Arch.

cd ..

makepkg -sri

Fedora instructions

Cockpit has always been intended to use on Redhat products. Fedora is a Redhat product (albeit developed by a separate community), so the Cockpit management tool is available in the software archive. To install launch a terminal window and enter the DNF command below.

sudo dnf install cockpit -y

When Cockpit is set up on Fedora, enable it for use with:

sudo systemctl enable --now cockpit.socket
sudo firewall-cmd --add-service=cockpit
sudo firewall-cmd --add-service=cockpit --permanent

Redhat Enterprise Linux instructions

Cockpit can be installed on RedHat Enterprise Linux, provided you’re using version 7.1 or later. The software is provided to users via the “Extras” software repository and must be enabled before installation.

To enable the “Extras” repo, launch a terminal and enter the following command.

sudo subscription-manager repos --enable rhel-7-server-extras-rpms

With the new repo enabled, use Yum to install Cockpit.

sudo yum install cockpit

Then, enable the software on Rhel to finish up.

sudo systemctl enable --now cockpit.socket
sudo firewall-cmd --add-service=cockpit
sudo firewall-cmd --add-service=cockpit --permanent

CentOS instructions

As CentOS tries to stay as close to RedHat Enterprise Linux as possible, it’s very easy to get Cockpit software working on the platform. As of now, those on CentOS version 7 and higher will be able to grab it with the Yum package manager quickly.

sudo yuminstall cockpit

Once Cockpit is working on CentOS, you’ll need to do a few things. Specifically, you’ll need to enable the software via systemd. It also must be allowed through the Firewall.

sudo systemctl enable --now cockpit.socket
sudo firewall-cmd --permanent --zone=public --add-service=cockpit
sudo firewall-cmd --reload

With the three commands above entered, Cockpit should be ready to use on CentOS!

Leave a comment