1. Linux

How to upgrade Ubuntu 20.04 to 22.04 (SSH)

There are several update commands which can be used in Ubuntu. Some of them are for software updates and some for major release update. Let’s review the commands and go through the upgrade from Ubuntu 20.04 to 22.04.

One should note that major release updates will always require a confirmation from the end user, so do not worry to accidently run an unwanted release upgrade.

Update the package list

Before upgrading the release, we get a new package list and update the software.

Update package list
#sudo apt-get update

Next thing will be updating the packages themselves.

#sudo apt-get upgrade
upgrading packages ubuntu

Ubuntu will show you the summary of all packages which going to upgraded and the disk space required for the upgrade. Press “Y” to proceed.

This will download and install all packages. Reboot the server after updating packages. Now we are ready to initiate the major release upgrade.

Release upgrade

Upgrading from Ubuntu 20.04 to 22.04 via SSH is a self-explanatory. Once you enter the command below, review the changes and press “y”.

#sudo do-release-upgrade -d

If you are running the upgrade within the main SSH session, Ubuntu will show a warning.

The thing is that if your Internet connection fails or PC reboots accidently, the upgrade will stuck and it will be harder to recover. You can use screen session to run the upgrade in the background.

Press “y” and Ubuntu will fetch the list new/updated/deleted packages and show you the summary.

You will receive an authentication request either to allow all or to ask for authorization for every service restart during the upgrade.

Below image shows that install script will ask you if you want to delete or leave the obsolete software. You can review the list of software or simply continue with “y”

Finally, when install is completed, you will be prompted for a restart. Press “y”.

Session will be closed. Once you re-login, you can check the current version with the command below.

#lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

Congratulations! You have successfully upgraded Ubuntu from 20.04 LTS to 22.04 LTS.