Data Centers Open Source

How to install Cockpit on CentOS 7

Cockpit is a powerful, web-based admin GUI for Linux servers. Here's how to install this tool on CentOS 7.

Image: Jack Wallen

Cockpit is a web-based server manager that allows you to not only get a quick peek at performance, but also to start and stop services, gain access to the server terminal, and more. The one caveat to using Cockpit on CentOS (as opposed to Fedora or Red Hat Enterprise Linux), is that you don't have all of the bells and whistles found on the other platforms (such as storage and networking). Even so, this is still a very handy resource to have for the administration of your Linux servers.

When you install Fedora Server, you get Cockpit out of the box. CentOS 7 isn't quite as lucky. However, installing Cockpit on CentOS 7 is actually really easy (and very much worth your time). In fact, Cockpit is such a great tool for systems administrators, I would recommend you installing it on your CentOS servers immediately upon completing the installation of the operating system.

I'm going to walk you through the process of installing Cockpit on CentOS 7. I will assume three things:

  • You already have CentOS 7 installed
  • You have access to the root user
  • Your CentOS 7 machine is on line

With those things in check, let's install.

Preparation

There is one package that must be installed, prior to installing Cockpit. Open up your CentOS terminal window and install the epel-release (Extra Packages for Enterprise Linux) package with the command:

sudo yum install epel-release

This package will allow you to install Cockpit. It is not so much a dependency as it is a repository. Okay that installation and allow it to finish (Figure A).

Figure A

Installing the necessary dependency for Cockpit.

Once that completes, let's update CentOS with the command:

sudo yum update

After the update runs, you'll need to reboot your server. If this is a server without a GUI, the command is:

sudo reboot

After the machine reboots, you're ready to install Cockpit.

Installation

Finally, we are ready to install Cockpit. Back at the terminal window, issue the command:

sudo yum install cockpit

The above command will pick up the necessary dependencies for the installation. When prompted (Figure B), okay the installation and wait for it to complete.

Figure B

Installing Cockpit and its dependencies.

Once the installation is complete, you must start and enable the Cockpit service with the following two commands:

sudo systemctl start cockpit
​sudo systemctl enable cockpit.socket

Finally, let's make sure the firewall is open. Out of the box, you shouldn't have any problem reaching Cockpit, but on the off-chance you do, you can open up the firewall with the following commands:

sudo firewall-cmd --add-service=cockpit
​sudo firewall-cmd --add-service=cockpit --permanent
​sudo firewall-cmd --reload

Logging into Cockpit

At this point, you can point your browser to https://SERVER_IP:9090 and log into Cockpit with the user root and the password you created for the root user. Once authenticated, you can begin using Cockpit (Figure C).

Figure C

Your Cockpit installation is ready to go.

A must have for Linux admins

Cockpit is one of those tools you'll grow dependent upon quickly. Once you start using it, you'll have it installed on all of your supporting Linux servers (such as Fedora, CentOS, and even Ubuntu). I have to admit, Cockpit does offer more options on Fedora Server, but it is still of great use on CentOS 7. Give it a try and see how quickly you find it to be your go-to Linux server management tool.

Also see

Visit TechRepublic