How do I upgrade Ubuntu server to Ubuntu 22.04?

How do I upgrade Ubuntu server to Ubuntu 22.04?

The latest release of Ubuntu is called Linux Ubuntu 22.04 and has been released in April 2022. It is the latest long-term support (LTS) release of the series and follows its predecessor, Linux Ubuntu 20.04, which was released in October 2020. As a long-term support release, Ubuntu 22.04 LTS will receive support for 10 years.



Why should I upgrade to Ubuntu 22.04?

Ubuntu 22.04 LTS is stable and will be supported for a long time.

However, if upgrading from a previous LTS version (such as 20.04LTS), it is recommended waiting until the firstpoint release (usually October of the release year).

Here’s a link to the the Ubuntu lifecycle and release cadence publication for further detail.



Steps for upgrading Ubuntu server

Before proceeding with the upgrade, please make sure to back up all the important data to your local drive. Ensure the backup the Apache root directory ( in most instances /var/www/html directory) and your MySQL / MariaDB databases.



  1. Perform an Update and Upgrade on the Ubuntu terminal with the below command

    # apt update -y && apt upgrade -y

    During installation, you will be prompted to select the following options, select keep the local version currently installed, and perform the reboot action after installation.




  2. Check the installed release.

    # cat /etc/os-release



  3. Since SSH use port 22, select another free port to connect for updating the server. In this case, we use port 2222.

    # ufw allow 2222/TCP

    # ufw reload

    # ufw status



  4. Install update-manger-core.

    # apt install update-manager-core



  5. Proceed with the Ubuntu 22.04 upgrade now

    # do-release-upgrade -d

    It will detect SSH connection and notify the new SSH port and will the service will be started on port 2222. Simply type Y and press ENTER to proceed.

    The upgrade tool will notify an alternative SSH port 2222 in case of an SSH connection interruption on the default port. Since the port is already opened, press ENTER.



  6. The update tool will analyse all the changes and will present you with a summary. Select Yes and press Enter to proceed with the installation. The server might restart several times while those services are getting upgraded.



  7. Once the upgrade is completed, restart the system to finish the upgrade. Press Yes and hit ENTER to reboot.



  8. Check the OS information after rebooting.

    # cat /etc/os-release



  9. Delete the 2222 SSH port added to the ufw firewall rules.

    # ufw delete allow 2222/TCP



  10. Free up the disk space by removing all the unnecessary packages.

    # sudo apt autoremove --purge




  11. Restart Apache and MySQL services

    # sudo systemctl apache2 restart

    # sudo systemctl mysql restart



Final Checks

Perform a thorough check if your web application is working properly.

Get in Touch

You need more information? Email me at [email protected]