Upgrade Ubuntu LTS versions
Run the update command to refresh the repos:
sudo apt update
Pull any upgradeable packages:
apt list --upgradable
Install any outstanding updates:
sudo apt upgrade -y
Reboot server so its clean:
sudo reboot
Once the server is back up run the above again to catch any additional entries.
Snapshot/backup your device.
Confirm the Update manager is installed/updated:
sudo apt install update-manager-core
Make sure in the update-manager is set to prompt for LTS releases:
tail /etc/update-manager/release-upgrades
If you’ve installed an LTS previously, it should say “Prompt=lts” at the bottom. Leave “Prompt=lts” as is. With this setting, Ubuntu will only upgrade to 22.04 LTS, and the LTS releases that come after (are much more stable).
If you’re using a non-LTS release, it should say “Prompt=normal.” If you upgrade from a non-LTS release, change it to “Prompt=lts” in a text editor (as root).
Upgrading the Server
Its best to complete the following commands from the console to not lose access during the upgrade process:
sudo -s
Execute the upgrade command:
do-release-upgrade