What is Cockpit?
Managing Linux servers exclusively through the command-line interface (CLI) can be intimidating for junior administrators. Cockpit is an incredibly powerful, open-source server management web interface sponsored by Red Hat. It provides a beautiful, real-time graphical dashboard where you can monitor CPU and RAM usage, read systemd journal logs, manage network interfaces, start/stop services, and even open a fully functional terminal directly in your web browser.
Step 1: Install the Cockpit Package
Cockpit is lightweight and is included in the official Ubuntu repositories. Open your terminal and install the primary package:
sudo apt update
sudo apt install cockpit -y
Because Cockpit interfaces directly with systemd, it does not require configuring a complex web server (like Nginx or Apache) to function.
Step 2: Enable the Cockpit Socket
Cockpit uses a systemd socket to listen for incoming connections. This is highly efficient, as the Cockpit service only actually runs when a user is actively connected to the web console.
Enable and start the socket using the following commands:
sudo systemctl enable --now cockpit.socket
You can verify that the socket is actively listening by checking its status:
sudo systemctl status cockpit.socket
Step 3: Allow Cockpit Through the Firewall (UFW)
Cockpit operates on TCP port 9090. If you have the Uncomplicated Firewall (UFW) enabled on your Ubuntu server, you must explicitly allow traffic on this port, otherwise, your web browser connection will time out.
Run the following command to open the port:
sudo ufw allow 9090/tcp
Step 4: Access the Web Interface
Open a web browser on your personal computer and navigate to your server’s IP address on port 9090 via HTTPS. For example:
https://192.168.1.50:9090
Note: Because Cockpit generates a self-signed SSL certificate upon installation, your browser will display a security warning (e.g., “Your connection is not private”). Click “Advanced” and proceed to the site anyway.
Step 5: Log In and Manage the Server
You will be greeted by the Cockpit login screen. Log in using the same username and password you use to SSH into the server (e.g., your standard user account).
If your account has sudo privileges, check the box that says “Reuse my password for privileged tasks” before clicking Log In. This grants the web dashboard administrative rights, allowing you to seamlessly restart services, install software updates, and manage storage drives through the graphical interface.