How to upgrade Ubuntu from 20.04 to 22.04

What’s new in Ubuntu 22.04

Ubuntu 22.04 – codenamed Jammy Jellyfish, was released by Canonical on April 21, 2022. This is the last Long Term Support (LTS) release since its predecessor, Ubuntu 20.04 LTS.

Ubuntu 22.04 brings significant improvements, new features and a number of new software packages such as:

PHP 8.1.2
OpenSSL 3.0
Ruby 3.0
Python 3.10.4
MySQL 8.0.28
PostgreSQL 14.2
Linux kernel v5.15.0-25 and MESA 22

Prerequisites

Before proceeding with the upgrade, make sure that the following requirements are met:

At least 20 GB of free disk space. You can check the available disk space with the df -h command.
Make sure you are logged into the server as root or as a normal user configured with sudo privileges. This is the user you will use to perform the upgrade process.

How to update the operating system

We connect to the server and look for the latest available packages for our applications. To do this, run the command:

apt update && apt upgrade -y

After that, we execute the command to update the OS itself to 22.04.

do-release-upgrade

We see that the OS has found an update. Write “y”, then press Enter. The OS notified us that it would open an additional SSH port so that we would not be disconnected from the server during the update process. Press Enter to confirm.

After a few minutes, we will receive information that a number of packages will be removed, updated and a number of packages will be installed, and also that the process may take several hours. We write “y”, press Enter and wait for the OS to update.

Some services will need to be restarted after updating some libraries and packages. In this pop-up window, select “Yes” to restart these services during the package update without prompting.

We will also have a question about the resolv.conf file
We answer with the letter “N”, as we leave it as it is.

After some time, there will be a new question about sshd_config.
Select as is “keep the local version currently installed” and press Enter.

Now we have to confirm that a number of packages will be removed.

Now we write the letter “y” and reboot the server so that the update process completes.

We login back to our server after one minute and execute the command to see if our OS has been updated

lsb_relase --a

As you can see, in our case, the OS has been updated and now we have Ubuntu 22.04, instead 20.04.