How to Install Cockpit on CentOS 7
Cockpit is a free and open source program for Linux server management. It is very lightweight and has a beautiful, easy to use web interface. It allows system administrators to easily perform tasks such as starting Docker containers, storage administration, and network configuration.
In this tutorial you will learn how to install the latest version of Cockpit on CentOS 7.
Prerequisites
- A Vultr CentOS 7 server instance.
- A sudo user.
Step 1: Update system packages
Before installing any packages on the CentOS server instance, it is recommended to update the system. Log in using the sudo user and run the following commands to update the system.
sudo yum -y install epel-release
sudo yum -y update
sudo shutdown -r now
Once the system has restarted, log in again as the sudo user and proceed to the next step.
Step 2: Install Cockpit
We can install the software from the default CentOS repository using the following command.
sudo yum -y install cockpit
Once you have installed Cockpit, start and enable it using the following commands.
systemctl start cockpit
systemctl enable cockpit.socket
Step 3: Configure firewall
Run the following commands to allow all of the required ports through the firewall.
sudo firewall-cmd --add-service=cockpit
sudo firewall-cmd --add-service=cockpit --permanent
firewall-cmd --reload
The installation of Cockpit is now complete, you can access the dashboard by navigating to the following URL.
http://<your-Vultr-server-IP>:9090
You may be prompted with a security warning about the SSL certificate of the site as it is self-signed, but you can ignore the warning and proceed to login area. Log into Cockpit using the root credentials of your VPS.
Installing new SSL certs
In order to use SSL certificates you need to combine them into one file in the following location with the cert file ending in .cert. The public key should be first, then the private.
/etc/cockpit/ws-certs.d
It should look something like this.
/etc/cockpit/ws-certs.d/ssl.cert
-----BEGIN CERTIFICATE-----
MIIDUzCCAjugAwIBAgIJAPXW+CuNYS6QMA0GCSqGSIb3DQEBCwUAMD8xKTAnBgNV
BAoMIGI0OGE2NGNkNmMwNTQ1YThhZTgxOTEzZDE5YmJjMmRjMRIwEAYDVQQDDAls
...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIDUzCCAjugAwIBAgIJAPXW+CuNYS6QMA0GCSqGSIb3DQEBCwUAMD8xKTAnBgNV
BAoMIGI0OGE2NGNkNmMwNTQ1YThhZTgxOTEzZDE5YmJjMmRjMRIwEAYDVQQDDAls
...
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCyOJ5garOYw0sm
8TBCDSqQ/H1awGMzDYdB11xuHHsxYS2VepPMzMzryHR137I4dGFLhvdTvJUH8lUS
...
-----END PRIVATE KEY-----