How to upgrade Ubuntu server

Before you begin: Back up your data! before going ahead with the upgrade as you may lose access to the server or an issue could occur during the upgrade.

At the time of writing this post, there is a new LTS (Long Term Support) version of Ubuntu (24.04) that has been released.

The version upgrade is only available after the first point release so for example if I want to upgrade to 24.04 then the upgrade is available when 24.04.1 is available. However, you can force the upgrade by switching to the development version however this isn’t recommended for production servers if you want to guarantee stability.

Performing the upgrade

Before doing the distribution upgrade the current system needs to be updated.

Run the update command to fetch the latest package list and then the upgrade command to download and install the latest packages.

The upgrade process may take a few minutes or so to complete and some prompts may appear which require you to select specific options.

sudo apt -y update && sudo apt -y upgrade

After installing the packages restart the server, wait till the server starts up again, and SSH back into it.

sudo reboot

Now run the command to start the version upgrade process.

sudo do-release-upgrade

To use the development release add the -d flag.

Please note: The development version isn’t recommended for production servers.

sudo do-release-upgrade -d

You will be presented with information on the new version and a request to either continue or cancel. Type in y and press the Enter key to continue.

There will be a few more prompts where you need to either press the y and Enter keys or just the Enter key to continue the process.

  • Creating a separate SSH process on port 1022 for recovery
  • Deleting packages that are no longer needed
  • Restarting the server

The upgrade process will take some time so it’s best to leave it and check back, it took me over an hour at the very least.

Reference: https://ubuntu.com/server/docs/how-to-upgrade-your-release