Introduction
Most system administrators are accustomed to managing their Linux servers from the command line. But some projects have made significant head way in coming up with robust solutions for administering Linux systems via a web interface. Cockpit is one such popular project. Cockpit is an open source and free system administration tool that allows you to easily manage and monitor a single Linux machine or multiple Linux servers via a web browser. The cockpit project has gained a lot of momentum since its development was taken over by Red Hat which is actively fixing bugs and adding new features to the tool. Using cockpit you can perform numerous system administration tasks from a single pane of glass like interface provided by cockpit. Some examples of the tasks that can be managed by cockpit are administrating storage, configuring network, inspecting logs and so on and so forth. While managing your servers with cockpit you can easily switch between cockpit and the command line. For example, a service started using cockpit could be stopped or restarted using the command line.
In this article, we will demonstrate how you could install Cockpit on a CentOS 7 server, and how to monitor and administer the server using Cockpit. The installation process would remain unchanged for any YUM based system like RHEL or Fedora.
Installing cockpit:
If you have the base and EPEL repositories available and enabled on your system then installing cockpit requires the execution of only one command which is as follows:
[root@linuxnix ~]# yum install cockpit Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile epel/x86_64/metalink | 8.0 kB 00:00:00 * base: download.nus.edu.sg * epel: epel.mirror.angkasa.id * extras: centos.exabytes.com.my * nux-dextop: mirror.li.nux.ro * updates: download.nus.edu.sg base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 nux-dextop | 2.9 kB 00:00:00 tigervnc-el7 | 2.9 kB 00:00:00 updates | 3.4 kB 00:00:00 xrdp | 2.9 kB 00:00:00 Resolving Dependencies ------------------------------------------------------------------output truncated for brevity Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: cockpit x86_64 172-2.el7.centos extras 47 k Installing for dependencies: cockpit-bridge x86_64 172-2.el7.centos extras 497 k cockpit-system noarch 172-2.el7.centos extras 1.2 M cockpit-ws x86_64 172-2.el7.centos extras 794 k libnl x86_64 1.1.4-3.el7 base 128 k python-dateutil noarch 1.5-7.el7 base 85 k python-dmidecode x86_64 3.12.2-2.el7 base 83 k python-ethtool x86_64 0.8-5.el7 base 33 k python-inotify noarch 0.9.4-4.el7 base 49 k subscription-manager x86_64 1.20.11-1.el7.centos base 993 k subscription-manager-rhsm x86_64 1.20.11-1.el7.centos base 285 k subscription-manager-rhsm-certificates x86_64 1.20.11-1.el7.centos base 195 k usermode x86_64 1.111-5.el7 base 193 k Transaction Summary ================================================================================ Install 1 Package (+12 Dependent packages) Total download size: 4.6 M Installed size: 10 M Is this ok [y/d/N]: y Downloading packages: (1/13): cockpit-172-2.el7.centos.x86_64.rpm | 47 kB 00:00:00 (2/13): cockpit-bridge-172-2.el7.centos.x86_64.rpm | 497 kB 00:00:00 (3/13): cockpit-ws-172-2.el7.centos.x86_64.rpm | 794 kB 00:00:00 (4/13): python-dateutil-1.5-7.el7.noarch.rpm | 85 kB 00:00:00 (5/13): libnl-1.1.4-3.el7.x86_64.rpm | 128 kB 00:00:00 (6/13): python-ethtool-0.8-5.el7.x86_64.rpm | 33 kB 00:00:00 (7/13): python-dmidecode-3.12.2-2.el7.x86_64.rpm | 83 kB 00:00:00 (8/13): cockpit-system-172-2.el7.centos.noarch.rpm | 1.2 MB 00:00:00 (9/13): python-inotify-0.9.4-4.el7.noarch.rpm | 49 kB 00:00:00 (10/13): subscription-manager-rhsm-1.20.11-1.el7.centos.x86_64.rpm | 285 kB 00:00:00 (11/13): subscription-manager-1.20.11-1.el7.centos.x86_64.rpm | 993 kB 00:00:00 (12/13): subscription-manager-rhsm-certificates-1.20.11-1.el7.centos.x86_64.rpm | 195 kB 00:00:00 (13/13): usermode-1.111-5.el7.x86_64.rpm | 193 kB 00:00:00 ------------------------------------------------------------------------------------------------------------------------------------ Total 9.6 MB/s | 4.6 MB 00:00:00 ------------------------------------------------------------------output truncated for brevity Installed: cockpit.x86_64 0:172-2.el7.centos Dependency Installed: cockpit-bridge.x86_64 0:172-2.el7.centos cockpit-system.noarch 0:172-2.el7.centos cockpit-ws.x86_64 0:172-2.el7.centos libnl.x86_64 0:1.1.4-3.el7 python-dateutil.noarch 0:1.5-7.el7 python-dmidecode.x86_64 0:3.12.2-2.el7 python-ethtool.x86_64 0:0.8-5.el7 python-inotify.noarch 0:0.9.4-4.el7 subscription-manager.x86_64 0:1.20.11-1.el7.centos subscription-manager-rhsm.x86_64 0:1.20.11-1.el7.centos subscription-manager-rhsm-certificates.x86_64 0:1.20.11-1.el7.centos usermode.x86_64 0:1.111-5.el7 Complete! [root@linuxnix ~]#
Starting Cockpit
Once the installation is completed successfully we’ll start the cockpit service and enable it on boot using the following systemctl commands:
[root@linuxnix ~]# systemctl enable cockpit [root@linuxnix ~]# systemctl start cockpit [root@linuxnix ~]# [root@linuxnix ~]# systemctl status cockpit ● cockpit.service - Cockpit Web Service Loaded: loaded (/usr/lib/systemd/system/cockpit.service; static; vendor preset: disabled) Active: active (running) since Mon 2018-09-03 17:12:33 UTC; 6s ago Docs: man:cockpit-ws(8) Process: 2040 ExecStartPre=/usr/sbin/remotectl certificate --ensure --user=root --group=cockpit-ws --selinux-type=etc_t (code=exited, status=0/SUCCESS) Main PID: 2049 (cockpit-ws) CGroup: /system.slice/cockpit.service └─2049 /usr/libexec/cockpit-ws Sep 03 17:12:33 linuxnix systemd[1]: Starting Cockpit Web Service... Sep 03 17:12:33 linuxnix remotectl[2040]: Generating temporary certificate using: sscg --quiet --lifetime 3650 --key-strength 204... Sep 03 17:12:33 linuxnix remotectl[2040]: Error generating temporary dummy cert using sscg, falling back to openssl Sep 03 17:12:33 linuxnix remotectl[2040]: Generating temporary certificate using: openssl req -x509 -days 36500 -newkey rsa:2048 ... Sep 03 17:12:33 linuxnix systemd[1]: Started Cockpit Web Service. Sep 03 17:12:33 linuxnix cockpit-ws[2049]: Using certificate: /etc/cockpit/ws-certs.d/0-self-signed.cert Hint: Some lines were ellipsized, use -l to show in full. [root@linuxnix ~]#
If you have firewalld enabled then an exception rule needs to be added for cockpit. Add Cockpit to the list of trusted services in firewallD.
firewall-cmd --permanent --zone=public --add-service=cockpit
Restart firewallD to take effect the changes.
firewall-cmd --reload
Accessing the cockpit web console:
Once you’ve started the cockpit service the cockpit web console will be available at the URL https://<server-ip-address>:9090/ Given below is a screenshot of the cockpit web console login page:
You can login to the server using your operating system user credentials. Given below is a screenshot of the cockpit dashboard where you can view real time resource utilization statistics about your system.
From here, you can do administrative tasks such as adding/deleting users, starting/stopping services, configuring network and so on.
Here are screenshots from some of the tabs available in the cockpit dashboard.
Logs
Network
Services
Terminal
A very useful feature of the cockpit tool is the ability to take a terminal session from the web interface and execute operating system commands within that session. Given below is a screenshot from a sample session.
Conclusion
This concludes our article on the basic understanding of the cockpit tool along with its installation and setup.
In the next article we will demonstrate how we can add a client machine to cockpit via the web console and administer it.
Sahil Suri
Latest posts by Sahil Suri (see all)
- Google Cloud basics: Activate Cloud Shell - May 19, 2021
- Create persistent swap partition on Azure Linux VM - May 18, 2021
- DNF, YUM and RPM package manager comparison - May 17, 2021
- Introduction to the aptitude package manager for Ubuntu - March 26, 2021
- zypper package management tool examples for managing packages on SUSE Linux - March 26, 2021