Ubuntu 22.04 is officially released on 22 April 2022 and available on all cloud platforms also. Here you are going to upgrade your system or server from Ubuntu 20.04 to Ubuntu 22.04. If you are running Ubuntu 18.04, you need to first upgrade to Ubuntu 20.04 and then finally upgrade to 22.04 LTS.
In this guide you are going to learn how to clean up your Ubuntu 20.04 server or system’s unused packages, old kernels, journal logs, apt cache and then upgrade to 22.04 LTS in simple steps.
This setup is tested on Google Cloud Platform VM running Ubuntu 20.04. So it should work well on other servers and other systems also.
- Root access to your system or server or a user with sudo privileges.
- Create a backup of your files (just for a precaution).
- Make sure you are running Ubuntu 20.04 currently.
Check Ubuntu Version
Check your current running Ubuntu OS version with the following command
Output DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
Cleanup and Update Packages
Update and upgrade the software packages to the latest version available.
sudo apt update sudo apt dist-upgrade -y
Clean up unused packages.
sudo apt-get autoremove --purge
Remove apt cache.
sudo apt-get clean
Remove journal logs.
sudo journalctl --vacuum-time=2d
Now you can upgrade to Ubuntu 22.04 LTS.
Upgrade to Ubuntu 22.04 LTS
Make sure you have update manager installed.
sudo apt install update-manager-core
Check for any available new Ubuntu releases using the following command.
sudo do-release-upgrade --check-dist-upgrade-only
This command will check for new Ubuntu releases.
Currently there are some problems with snapd and update-notifier, so the Ubuntu 22.04 LTS upgrade is on hold. It will be available in a couple of days. Once it is available you can upgrade using the following command.
If you didn’t see any releases, you can also install the development release by including the -d option.
sudo do-release-upgrade -d
You will be prompted few steps to accept before proceeding the upgrade. Accept those and continue. This will take sometime for the upgrade process to complete.
Once the upgrade is completed you will be prompted to restart the system.
System upgrade is complete. Restart required To finish the upgrade, a restart is required. If you select 'y' the system will be restarted.
Choose Y and hit ENTER to restart your system.
Verify Ubuntu 22.04 Upgrade
Once the upgrade is completed you can verify the upgrade using the below command.
Output DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"
Now you have learned how to upgrade your system from Ubuntu 20.04 to Ubuntu 22.04 LTS.
Thanks for your time. If you face any problem or any feedback, please leave a comment below.