Cockpit is a free remote server manager that is lightweight and easy to use for GNU/Linux servers. Cockpit is a web-based graphical interface for servers intended for people new to Linux to the experts such as sysadmins. Cockpit makes Linux discoverable, allowing anyone using the software to perform tasks such as start containers, administer storage, configure networks, and inspect logs.
One of the drawbacks of using Cockpit with Ubuntu 20.04 LTS is being a long-term stable release newer versions of Cockpit will not feature in the default repository. However, in the following tutorial, you will learn how to install or upgrade to the latest version of Cockpit for your Ubuntu 20.04 system.
Table of Contents
- Recommended OS: Ubuntu 20.04 – optional (Ubuntu 21.04)
- User account: A user account with sudo or root access.
- Required Packages: Ubuntu Backports installed.
- Optional Packages: Cockpit
Updating Operating System
First, before anything, update your Ubuntu operating system to make sure all existing packages are up to date:
sudo apt update && sudo apt upgrade -y
Install Ubuntu 20.04 Backports
To install or update Cockpit to the latest version using the APT package manager, you need to install backports. By default, Ubuntu 20.04 repository is far behind the current latest versions of Cockpit.
The process is very straight forward as the tutorial will show. Those unfamiliar with backports offer a way to provide newer versions of software for older Ubuntu releases selectively. Most commonly, the Backports team will offer new versions of standalone applications which can be safely updated without impacting the rest of the system.
To install backports, open up the file /etc/apt/sources.list as follows:
sudo nano /etc/apt/sources.list
Next, add the following line:
deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
Notice the focal-backports, and this is the backport name of your Ubuntu operating system.
For the Ubuntu armhf or arm64 ports, use this line instead:
deb http://ports.ubuntu.com/ubuntu-ports trusty-backports main restricted universe multiverse
If you are unsure, always use the first option, as it will suit most users.
Now update your repository list as follows:
sudo apt-get update
Note that your existing APT packages will not be updated to the latest versions from backports, and you will need to do so manually for each package you want to install or upgrade.
Install or Upgrade Cockpit to Latest Version
Now that you have installed the backports, you can now proceed to either upgrade or install Cockpit. Currently, at the time of writing, Ubuntu 20.04 default repository Cockpit version 215, and the most recent updated version on Ubuntu backports is version 248.
To install or upgrade, use the following command:
sudo apt-get install -t focal-backports cockpit
This command will install the latest version of Cockpit and install the latest dependencies for Cockpit.
Now log in using your favorite Internet Browser and type your domain or server IP address with port:9090 for Cockpit and check the latest version. For example, HTTP://192.168.51.131:9090.
You should have gone from this old version:
To the latest version as below:
Congratulations, you have successfully installed or updated the latest Cockpit Webui Console.
How to fix cannot refresh cache whilst offline in Cockpit
This is the most common error with Ubuntu users and Cockpit, and it seems to be hit and miss; however, it is the most common support question I have seen thus far. To fix this problem, do the following steps:
First, install the network-manager package:
sudo apt install network-manager
Next, open up the 00-installer-config.yaml file as follows:
sudo nano /etc/netplan/00-installer-config.yaml
Now, copy and paste the following text:
# This is the network config written by 'subiquity' network: ethernets: enp4s0: dhcp4: true version: 2 renderer: NetworkManager
You must be at the same indent level as version: 2 on a new line insert renderer: NetworkManager. This has to be done as the above example precisely, or else it will not work.
Now restart network-manager as follows:
sudo systemctl restart network-manager.service
Note, if you have issues, do a complete restart of your system. This will fix 99% of the problems of cache issues relating to Cockpit.
Comments and Conclusions
In the tutorial, you have learned how to install Ubuntu backports for Focal Fossa 20.04, along with installing or upgrading to the latest version of Cockpit. Overall, you won’t find much use for backports. It is not recommended to use them in some cases, but they can be helpful for some packages like Cockpit if they are constantly updated, and new versions arrive.
For users fresh to Cockpit, visit the official documentation page to learn more about its features and how to use it.