How to Install Cockpit on Debian 12
Introduction
Cockpit is an open-source, web-based graphical server management control panel that simplifies server management using system APIs and commands to perform system administration tasks. It's highly extensible with modules that enable additional Cockpit functionalities such as container management, system reporting, and web server configurations. To get started, you can easily install Cockpit on Debian 12, giving you a user-friendly interface for managing your server's resources and tasks.
This article explains how to install Cockpit on Debian. You will access the Cockpit management control panel, secure it with trusted SSL certificates, and install modules like Podman to manage containers on the server.
Install Cockpit on Debian 12
Cockpit is available in the default package repositories on Debian 12. Follow the steps below to update the APT package index and install Cockpit.
Update the server's package information index.
console$ sudo apt update
Install Cockpit.
console$ sudo apt install cockpit -y
Enable Cockpit to start at system boot.
console$ sudo systemctl enable --now cockpit.socket
Start the Cockpit service.
console$ sudo systemctl start cockpit
View the Cockpit service status and verify that it's active.
console$ sudo systemctl status cockpit
Output:
● cockpit.service - Cockpit Web Service Loaded: loaded (/usr/lib/systemd/system/cockpit.service; static) Active: active (running) since Fri 2025-01-10 12:10:47 UTC; 5s ago TriggeredBy: ● cockpit.socket Docs: man:cockpit-ws(8) Process: 68819 ExecStartPre=/usr/lib/cockpit/cockpit-certificate-ensure --for-cockpit-tls code=exi> Main PID: 68833 (cockpit-tls) Tasks: 1 (limit: 1061)
Allow the Cockpit port
9090
, HTTP port80
, and the HTTPS port443
through the default firewall configuration.console$ sudo ufw allow 9090,80,443/tcp
Reload UFW to apply the firewall changes.
console$ sudo ufw reload
View the UFW status and verify all active firewall rules.
console$ sudo ufw status
Output:
Status: active To Action From -- ------ ---- 22/tcp ALLOW Anywhere 80,443,9090/tcp ALLOW Anywhere 22/tcp (v6) ALLOW Anywhere (v6) 80,443,9090/tcp (v6) ALLOW Anywhere (v6)
Secure Cockpit with Trusted SSL Certificates
SSL certificates encrypt the traffic between a web browser and the Cockpit control panel. Follow the steps below to generate trusted Let's Encrypt SSL certificates to secure Cockpit on your server.
Install the Certbot Let's Encrypt client tool.
console$ sudo apt install certbot -y
Request a new SSL certificate using your Cockpit domain. Replace
cockpit.example.com
with your actual domain andadmin@example.com
with your active email address.console$ sudo certbot certonly --standalone -d cockpit.example.com -m admin@example.com --agree-tos
Link the
fullchain.pem
SSL certificate file to the/etc/cockpit/ws-certs.d/
directory. Replacecertificate.cert
with your desired certificate filename.console$ sudo ln -sf /etc/letsencrypt/live/cockpit.example.com/fullchain.pem /etc/cockpit/ws-certs.d/certificate.cert
Link the
privkey.pem
private key to the/etc/cockpit/ws-certs.d/
. Replacecertificate.key
with your desired filename.console$ sudo ln -sf /etc/letsencrypt/live/cockpit.example.com/privkey.pem /etc/cockpit/ws-certs.d/certificate.key
Restart Cockpit to apply the changes and load the SSL certificate files.
console$ sudo systemctl restart cockpit
Access Cockpit
Cockpit uses the default server users and permissions to perform system administration tasks using the web-based control panel. Cockpit does not support root
user authentication and requires non-root sudo user accounts to manage the server using the administrative access role. Follow the steps below to create a dedicated non-root sudo user and access Cockpit on your server.
Create a new non-root user such as
cockpitadmin
and enter a strong user password when prompted.console$ sudo adduser cockpitadmin
Add the
cockpitadmin
user to the sudo users group.console$ sudo usermod -aG sudo cockpitadmin
Access the Cockpit port
9090
using your domain in a web browser such as Chrome.https://cockpit.example.com:9090
Log in to Cockpit using your
cockpitadmin
user credentials.
Manage a Server Using Cockpit
You can perform the following server management and monitoring tasks within the Cockpit control panel.
Click the Turn on administrative access prompt to enable the user's sudo privileges in your Cockpit session.
Click Overview to monitor the system resource usage (CPU, and memory), system health, system information, and basic configuration.
Click Logs tab to view and analyze the server logs.
Click Storage to view the server's storage usage information.
Click Accounts to manage user accounts on the server.
Click Services to monitor and manage system services on the server.
Click Applications to view the Cockpit addons installed on the server.
Click Software Update to view the pending software updates on the server.
Create and Manage Containers Using Cockpit Podman
Cockpit Podman is a container management module that lets you create and manage containers using Podman on your server. Follow the steps below to install the Cockpit Podman module and manage containers on your server.
Click the Terminal tab to access the server terminal in your web browser.
Install the Cockpit Podman module.
console$ sudo apt install cockpit-podman -y
Refresh your Cockpit window and click Podman containers on the left navigation menu.
Click the Images options menu and select
Download new image
from the list.Enter
nginx
in the Search field.Select the
docker.io/library/nginx
image from the list and click Download to pull the container image.Click Create Container in the Containers section to set up a new container.
Keep the
Details
configuration information.Navigate to the
Integration
tab and click Add port mapping.Map the host HTTP port
80
to the container port80
.Click Create and Run to deploy the container
Click to expand the container in the Containers section and verify that it's in a
Running
state.Navigate to the
Logs
tab to monitor the container logs.Click the options menu in the container's top-right corner to view the available container management actions.
The container management actions include stopping, force stopping, restarting, force restarting, pausing, creating a checkpoint, renaming, committing, and deleting the container.
Conclusion
You have installed Cockpit on Debian 12 and managed the server using the web-based control panel. You can install multiple modules to extend Cockpit with additional functionalities and use the control panel to perform system administration tasks. For more information, visit the Cocktpit documentation.