Install or Update to Latest Version Cockpit on Ubuntu 20.04
If you’re tired of typing endless systemctl status commands and would rather click through a clean web UI, this guide will get Cockpit up‑to‑date on your Ubuntu 20.04 box. We’ll cover both fresh installs and upgrades from the older packages that ship with the default repos.
Why the stock repo isn’t enough
Ubuntu 20.04’s official repository ships Cockpit 221, which is fine for basic monitoring but lacks recent fixes (like the new SELinux module handling) and UI tweaks. The upstream project pushes a newer release roughly every three months, so if you want the latest features you have to point apt at their own PPA.
Add the official Cockpit repository
sudo apt update
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:cockpit-project/cockpit
Why?
software-properties-common gives us add‑apt-repository, a tiny helper that writes the new source list entry and pulls in the GPG key. The PPA is maintained by the Cockpit developers, so you’ll always get the freshest stable build.
Install or upgrade Cockpit
If Cockpit isn’t already on the machine:
sudo apt update
sudo apt install -y cockpit
If you’re upgrading from an older version (say 221) the same command works; apt will see a newer candidate in the PPA and replace the old packages.
Why this matters
Running apt update after adding the repo refreshes the package index, ensuring the dependency resolver sees the newest versions of cockpit, cockpit-ws, and any optional modules you might need (like cockpit-machines for libvirt).Enable the service and open the firewall
sudo systemctl enable --now cockpit.socket
sudo ufw allow 9090/tcp
The socket unit starts Cockpit on demand, so you don’t waste resources when nobody’s logged in. Opening port 9090 lets you reach the UI from another machine; if you’re behind a VPN or SSH tunnel you can skip the firewall rule.
Verify it’s running
Open a browser and point it at https://<your‑host>:9090. You should see Cockpit’s login screen with a green “Running” badge under the status line. If the page refuses to load, run:
sudo systemctl status cockpit.socket
The output will tell you whether the socket is active or if something (like a conflicting service on port 9090) is blocking it.
Common hiccups
Missing libvirt-daemon-system – I’ve seen this happen after a bad driver update; apt complains about an unmet dependency for cockpit-machines. The fix is to install the missing package manually:
sudo apt install -y libvirt-daemon-system
Stale GPG key – Occasionally the PPA’s signing key expires. If you get “NO_PUBKEY” errors, refresh it with:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6D2C0EFA
Port already in use – Some people run a custom web server on 9090. Change Cockpit’s port by editing /etc/cockpit/cockpit.conf and adding Listen = 9191, then restart the socket.
That’s it—Cockpit should now be humming along with the latest features, ready for you to manage services, storage, containers, or just peek at system logs without leaving your browser.