How to upgrade Ubuntu server to 22.04 LTS

Most of the old servers are either on 16.04 or 18.04. It’s time for you to upgrade. Mine are all on 20.04, even though it is fine to leave it as is for now, but as you know I like to keep up with the latest software and pace of OS. So I decided to upgrade to latest Ubuntu 22.04. In this article I am going to guide you how to upgrade your Ubuntu server to 22.04 LTS.

If you follow this guide and your server has a good Internet connection, the whole process will take around 30 minutes but it could be more or less. Let’s get into it.

Before upgrade

There are few things we need to take care of before jumping to the upgrade process. Make sure your system is up to date.

apt update && apt upgrade

Remove and clean unwanted packages.

apt autoremove && apt autoclean

Ubuntu upgrade process need an extra SSH port to be opened in case something goes south. For that we will allow port 1022 in the firewall if UFW is enabled.

ufw status

ufw allow 1022/tcp

ufw reload

Once done if reboot is required, reboot the server.


After reboot, it’s time to backup your data and databases (if any). Please don’t skip this step and make sure you do take the backup.

We will now stop the running processes like Apache, MariaDB, PHP FPM etc.

You can find the running packages with:

systemctl | grep running

Remember to not stop any critical and system services.

systemctl stop apache2

systemctl stop mariadb

For PHP FPM (php8.0-fpm is a placeholder, change to yours accordingly) and Redis etc:

systemctl stop php8.0fpm

systemctl stop redis

We are pretty much done with pre upgrade process. Before starting the upgrade, just make sure you are on lts Prompt (Prompt=lts) at the end of the file.

cat /etc/update-manager/release-upgrades


Now we will start the upgrade process.


This will check your system and proceed with the setup if all checks passed.


From here on most of the prompts are self explanatory, carefully read them and proceed.

Let’s me explain some of them.

At this point you will be shown what are going to be removed, upgraded etc. Press d to get these statistic when shown.


You can type y to confirm it.


During the upgrade, you will be asked to either keep your old configurations or use the new one. Keep the old ones as a precaution.


The last step is to remove the obsolete packages.


Reboot the system when asked.


Post upgrade


After successful reboot, we need to perform few quick checks and remove the port added at the beginning.

ufw delete allow 1022/tcp

ufw reload

ufw status

Upgrade and clean the system (not needed though, just for safety).

apt update && apt upgrade && apt autoremove && apt autoclean

And that’s it, enjoy.