Data Centers

How to use the open source Cockpit interface to manage your server

The open source Cockpit management interface is a web-based system for IT professionals to manage applications and containers running on a server. Here's how you can leverage it in your business.

Image: iStockphoto/scanrail

For many system administrators, the suggestion of a web-based management interface is one that produces a great deal of scorn. Traditionally, solutions like Plesk, cPanel/WHM, and Webmin are generally built around the assumption that the server in question will be running Apache, PHP, and MySQL, with little room to deviate from these defaults. This paradigm rarely plays well with newer server technology, particularly node.js.

SEE: Securing Linux policy template (Tech Pro Research)

Rightly or wrongly, the use of these interfaces gives the impression that all server configuration must now be conducted through the interface, and not through manually editing files or use of the command line. Depending on your particular use case, they may also be too heavily focused on managing individual users in a hosting reseller operation. Consequently, the management solutions for servers—rather than users—have been few and far between, with the few options available overwhelmingly closed source or hardware-specific.

Enter Cockpit

Cockpit takes a completely different approach to server management. Rather than focusing on the metering and distribution of resources on a shared server, Cockpit provides a web interface for normal administrative tasks that would otherwise be performed via the command line—changing the system hostname, adding and removing users, and restarting the system, for example. Advanced configuration and control of services in systemd is also possible, complete with logs relevant to the item being manipulated. There is also a web-based terminal, if you need it. This can be particularly helpful when connecting to a server using a smartphone, tablet, or Chromebook. Of course, Cockpit also provides a real time visualization of resource utilization.

SEE: On-the-job training: How to develop IT skills that translate into results (Tech Pro Research)

Cockpit also provides a plugin for use with Docker containers, allowing for the creation, destruction, installation, and management of containers. Searching for available containers and installation can all be done from within Cockpit. Container configuration is also simplified. For example, allowing containers access to certain ports on outside networks can be done with a few clicks.

Getting started with Cockpit on your server

Cockpit is available in the default repositories in Fedora, and in the Extras repository in Red Hat Enterprise Linux. Repositories for Cockpit also exist for Debian, Ubuntu, and Arch. Naturally, as different distributions use different package managers, the exact instructions for your distribution will vary (and are available here). Generally, the three steps to getting started are package installation, configuring Cockpit as a service, and creating an exception for it in your firewall (if one exists).

On Fedora servers, this can be done using the following commands:

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

For Ubuntu and Debian, the Cockpit repository must first be added, as it is not available in the official repositories.

For Ubuntu:

sudo add-apt-repository ppa:cockpit-project/cockpit

For Debian:

deb unstable main
sudo apt-key adv --keyserver --recv-keys F1BAA57C

After adding the repository, both Ubuntu and Debian users can install Cockpit using these commands:

sudo apt-get update
sudo apt-get install cockpit
sudo systemctl enable --now cockpit.socket

After installing, you can log in using your server account credentials at https://server-ip-address:9090.

What's your view?

Do you use Cockpit or some alternative server management tool on your systems? Have you avoided management tools in the past because of issues of complexity or conflicting configuration files? Share your experiences in the comments below.

See also

About James Sanders

James Sanders is a Java programmer specializing in software as a service and thin client design, and virtualizing legacy programs for modern hardware.

Editor's Picks

Free Newsletters, In your Inbox