Egemen
Korkmaz
jun 17, 2022

How to upgrade AWS EC2 Ubuntu 20.04 LTS to 22.04 LTS

Make sure you have at least 30 GB of free space on your hard disk. You can run the following command to know about the free space

df -h

Check the existing version of your Ubuntu, it should be 20.04

 lsb_release -a

Output:

Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.4 LTS
Release:	20.04
Codename:	focal

Run sudo apt update command:

sudo apt update

Run sudo apt upgrade command:

sudo apt upgrade

Reboot the machine:

sudo reboot

Time to run the final command to the upgrade from Ubuntu 20.04 to 22.04

sudo do-release-upgrade

Output:

Fetching and installing the upgrade can take several hours. Once the 
download has finished, the process cannot be canceled.

Slect “yes” in the Package configuration modal.

After installing all the features, it will prompt you to restart the machine:


System upgrade is complete.

Restart required 

To finish the upgrade, a restart is required. 
If you select 'y' the system will be restarted. 

Continue [yN] 

Enter “y” to restart the machine.

Run the  lsb_release -a command again after restart to check the Ubuntu version:

lsb_release -a

The output will be like this:

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

You are done with upgrade of AWS EC2 Ubuntu 20.04 LTS to 22.04 LTS.