To upgrade from Ubuntu 16.04 LTS to the latest LTS (Long Term Support) release, you’ll need to follow a series of steps. The current Ubuntu LTS at the time of writing is 22.04.3, and this process is unlikely to change in the near term future.
Here are the steps I followed to upgrade from Ubuntu 16.04 LTS to the latest LTS version.
- Backup Your Data: Before you begin the upgrade process, it’s essential to back up your important data to ensure you don’t lose any files or configurations. How you do this is up to you and is outside the scope of this post.
- Check Current Version: First, confirm that you are running Ubuntu 16.04 LTS. You can do this by opening a terminal and running the following command:
lsb_release -a example output No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.7 LTS Release: 16.04 Codename: xenialCode language: Shell Session (shell)
This command will display information about your Ubuntu version. For the nerdy amongst us (hello, everyone), then you may be interested to know that
lsb stands for Linux Standard Base.
- Update Existing Packages: Make sure your system is up to date by running:
sudo apt update sudo apt upgrade sudo apt dist-upgradeCode language: Shell Session (shell)
dist-upgrade command is used to upgrade packages on your Ubuntu system, but it is not specifically designed for upgrading the entire distribution from one release to another. We will cover how to do exactly that below.
- Install the Update Manager: If you don’t already have the
update-manager-corepackage installed, you can do so with the following command:
sudo apt install update-manager-coreCode language: Shell Session (shell)
For me, in all my testing, this has always come back blank. As if nothing changed. But it is in the official docs, so I do it.
- Edit Release-Upgrades Configuration: Open the release-upgrades configuration file in a text editor:
sudo vim /etc/update-manager/release-upgradesCode language: Shell Session (shell)
Inside the file, set the
Prompt option to
lts. It should look like this:
Prompt=ltsCode language: Shell Session (shell)
Another option would be
Prompt=normal which also gives you regular non Long Term Support (LTS) releases. For stability, on servers, I prefer LTS.
Save and exit the text editor. If you used
vim then that’s
esc followed by typing
:wq and hitting enter.
- Run the Upgrade: Now, you can initiate the release upgrade by running:
sudo do-release-upgradeCode language: Shell Session (shell)
Follow the on-screen prompts and instructions. During the upgrade process, you may be asked to confirm that you want to proceed. Type “y” to confirm.
This process can take several hours depending on your PC capabilities, and your internet connection.
This will only upgrade you to the next LTS release.
E.g. if you are on Ubuntu 16.04, you will be upgraded to Ubuntu 18.04.
You will need to redo this process several times to reach the latest LTS release.
- Review Configuration Files: During the upgrade process, you may be asked to review and decide how to handle configuration file changes. You can choose to keep your current version of the configuration file or install the package maintainer’s version.
All the information is usually on screen, but it helps these days to have a second device (hint: your phone) ready for additional Googling.
- Reboot: Once the upgrade is complete, you should reboot your system to ensure that all changes take effect:
sudo rebootCode language: Shell Session (shell)
The reboot process is not automatic. You will need to do this manually.
- Check New Version: After rebooting, you can verify that you’re now running the latest LTS version by running the following command:
lsb_release -a example output No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal remember, you may need to upgrade several times to reach the latest LTSCode language: Shell Session (shell)
That’s it! You should now be running the latest LTS version of Ubuntu.
Please note that the steps and specific version numbers mentioned in this guide may change if newer LTS versions have been released since my last knowledge update.
Be sure to check the official Ubuntu documentation for the most up-to-date instructions for your specific case.