Learn how to install and take advantage of cockpit on an Ubuntu 18.04 machine
- Root permissions
- # – requires given linux commands to be executed with root privileges either
directly as a root user or by use of
- $ – requires given linux commands to be executed as a regular non-privileged user
Cockpit is a web-based system administration service, which let us manage machines in a nice and easy way. Its aim is to simplify daily administration tasks, including resources, network and users monitoring and management.
Originally available for the Rhel distributions family, it was possible to install it on Ubuntu 16.04 by using an external
ppa. With Ubuntu 18.04 it has been included in the official repositories, therefore its installation has become even simpler and safer.
As just said, the cockpit package is available in the official Ubuntu 18.04 repositories, so installing it it’s just a matter of running:
# apt-get update && apt-get install cockpit
Few seconds after running this command, cockpit will be installed on our system and automatically started.
Cockpit uses port
9090 for its web interface, therefore we can reach it by launching our favorite web browser and typing
localhost:9090 in the address bar. Here I am assuming we are on the same machine cockpit is running on: to access the service from another machine, we have to use the server ip. In this case a firewall exception is also needed for the port to be reachable.
The cockpit web interface
Once we reach the web interface, we will be prompted to login:
We must now insert our credentials in the related input fields and click on the
Log In button. Once logged in we will be redirected to the main cockpit page:
Let’s take a look at it. The main page section shows us some information about the machine we are running on, as the
operating system and
system time. In this case I am running Ubuntu on a virtual machine, therefore the value of the hardware section is
QEMU Standard Pc.
We also have a dropdown menu which let us perform a power option on the system as restart or shutdown. On the right we can see some graphs which let us monitoring crucial system activities, in order: Cpu and memory usage, disk activity and network traffic.
The logs section
In the left column menu, just below the
system section, we can click on
logs to access to the page dedicated to system logs. Here, at the top of the page, we have two nice menus which let us filter the logs by period of time and severity, choosing between
To access detailed information about a log message, all we have to do is to click on the corresponding row: we will be redirected to a page containing the log details.
The storage section
Proceeding further we have the
storage session. Here we have some graphs displaying disks reading and writing activities, and immediately after a status bar indicating the filesystems usage amount. We have also the option to easily add
NFS Mounts and
We could inspect a specific drive by clicking on the related section on the right in the
Drives box: we will also be able to create a new partition table (if some conditions are respected – the disk must not be mounted, for example) on the specified drive: the operation will erase all the data on it.
The network section
In section dedicated to network monitoring and administration, it’s possible to observe graphs about sent and received packets for each interface, and network activity in general. Details about an interface, such as its
MAC address are visible by clicking on an interface row: here we also have the chance to enable or disable said interface. It’s also possible to easily add a
bridge or a
vlan using the dedicated buttons. On the bottom of the page the network logs are shown.
The accounts and services sections
The last two available sections are about accounts and services management. In the former we can very easily create, delete or obtain information about the users available on the system. By clicking on a specific user section we will have the option to change its password, lock its account and even add authorized public
services section, we will be presented with an overview of system daemons and targets. The web interface grants us the ability to start, stop, enable or disable each service, showing us its current state. Thanks to cockpit, we can also easily manage systemd
targets (the equivalent of classic system runlevels),
Although not a full substitute for the command line, cockpit gives us the opportunity to have a nice graphical overview of the core components and overall status of a machine. Multiple machines can be managed, by adding them to the main cockpit server, that is the machine on which the service it’s running on. Daily tasks are easily accomplished through the web interface we just took a tour of: try it, it could make you life easier!