Upgrading Ubuntu Server to 20.04 Focal Fossa
Notes on upgrading Ubuntu Server from 19.04 to 20.04
Preparation
Before upgrading your Ubuntu server take a backup or snapshot of your server so that you can restore to a working server if the upgrade fails at any point. My hosting provider Digital Ocean offer a really simple console which makes taking snap shots really easy.
Upgrading to Ubuntu 20.04 LTS (Focal Fossa) is a good idea it being a long term support release which will be supported for the next five years. It comes with a lot of new packages and major software upgrades, including the latest versions of Java, Python, Ruby, PHP and many more. This release is based on the Linux 5.4 LTS kernel and adds support for new hardware and file systems.
Check for held packages & update
Start by checking if you have any held packages by using the the showhold command. If you do have any then mark them as un-held by issuing an un-hold command followed by the package names listed in the previous command.
sudo apt-mark showhold
sudo apt-mark unhold package_name
Once you have un-held any packages, perform a standard update and upgrade and then reboot the server.
sudo apt update
sudo apt upgrade
sudo systemctl reboot
Purge & remove unwanted packages
After the server restarts then perform a full upgrade and then purge any unwanted or unused packages to recover some disk space.
sudo apt full-upgrade
sudo apt --purge autoremove
Upgrade to 20.04
At this point you’re ready to upgrade from 19.04 to 20.04 by performing the release upgrade commands. As the upgrade progresses you’ll be prompted to answer various questions in relation to your setup. The questions will vary depending on what software you’ve already installed.
sudo apt install update-manager-core
sudo do-release-upgrade -d
Verifying the version number after the upgrade
After the upgrade has completed and the server has rebooted you can check the current version of your Ubuntu server by checking the release version.
lsb_release -a
Which should output something like.
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal