How to Manage a Linux Server with Cockpit (Updates, Storage, Logs and Terminal in a Browser)

Everything in this series is done from the terminal, and that's the right way to learn it. But some jobs are quicker with a screen in front of you: watching CPU graphs, applying updates, formatting a new disk, reading logs with a filter box. Cockpit is Red Hat's web console for Linux, it's in Ubuntu's repositories, and it uses your normal server login. Think of it as htop, apt, lsblk, journalctl and a terminal behind one page.
Quick reference
| Task | What |
|---|---|
| Install | sudo apt install cockpit -y |
| Start | sudo systemctl enable --now cockpit.socket |
| Open | https://server-ip:9090, your usual username and password |
| Extras | cockpit-machines (VMs), cockpit-storaged, cockpit-pcp (history) |
| Keep it local | sudo ufw allow from 192.168.1.0/24 to any port 9090 |
| Admin actions | click Limited access at the top to turn on sudo |
1. Install
sudo apt install cockpit -y
sudo systemctl enable --now cockpit.socket
sudo ufw allow from 192.168.1.0/24 to any port 9090
Open https://192.168.1.50:9090. The browser warns about the self-signed certificate; accept it (or put Cockpit behind the reverse proxy with a real one). Log in with your normal account. Turning off password login for SSH doesn't affect Cockpit — it authenticates locally.
Click Limited access at the top right and enter your password to switch on administrative mode (it's sudo for the web page).
2. What's on the page
- Overview — CPU, memory, disk and network graphs, uptime, pending updates, the hostname and time zone (editable here).
- Logs — journalctl with a priority filter and a search box. The quickest way to read logs if you don't fancy the command line.
- Storage — every disk and partition; format, mount, create an fstab entry, see SMART health, with a form instead of tutorial 22's commands.
- Networking — interfaces, bridges and bonds. Leave the firewall to UFW.
- Accounts — add users, set passwords, add SSH keys.
- Services — the systemctl list; start, stop, enable with buttons.
- Software updates — see what's waiting, apply, and a toggle for automatic updates.
- Terminal — a real shell in the browser. Handy on a phone.
3. Useful add-ons
sudo apt install cockpit-machines cockpit-storaged cockpit-pcp -y
cockpit-machines adds virtual machines (tutorial 81); cockpit-pcp keeps performance history so the graphs show the past, not just now. For Samba shares there's a community cockpit-file-sharing package from 45Drives that makes shares a form too.
4. Several servers in one page
On the Cockpit of your main server, the top-left menu → Add new host, enter the Pi's address and user. You switch between machines in one tab; each one needs Cockpit installed.
Keep it private
Cockpit is a login to the whole server. LAN and VPN only, never port-forwarded. If you proxy it through Nginx for a nicer address, add the WebSocket lines and this to /etc/cockpit/cockpit.conf:
[WebService]
Origins = https://cockpit.example.com
ProtocolHeader = X-Forwarded-Proto
Troubleshooting
Login fails with the right password. The account is locked for password login (passwd -S john), or PAM 2FA (tutorial 70) is prompting — Cockpit supports it, enter the code when asked.
"Not permitted to perform this action." You haven't switched on administrative access (top right).
Graphs are empty. sudo apt install cockpit-pcp for history.
Something else is on 9090. Change the port in /etc/systemd/system/cockpit.socket.d/listen.conf (ListenStream=9091) and daemon-reload.
Wrapping up
One package, one URL, your existing login, LAN only. It doesn't replace the terminal — it sits beside it for the days when a graph or a form is faster. And when something's wrong at 11 pm, the Logs page on your phone is a kinder place to start than SSH.
