Important: Take a server snapshot at your provider before upgrading.
Once you've taken a snapshot of your server, SSH in to your server as root and run the following command to make sure your server is ready to be upgraded to a new version of Ubuntu.
sudo apt-get update && sudo apt-get dist-upgrade && sudo dpkg --configure -a
If the above command fails or prints an error messages, do not proceed with upgrading to a newer Ubuntu version.
Once all packages have been updated, reboot your server by running this command:
To upgrade your Ubuntu 20.04 server to Ubuntu 22.04, SSH in to your server as root and run the following command:
sudo do-release-upgrade -f DistUpgradeViewNonInteractive
Once the upgrade is complete, reboot your server.
If the upgrade completes without errors, take a new snapshot of your server so you'll have a snapshot of the server after the upgrade.
If the upgrade fails or encounters any errors, restore your server to the snapshot you made before you began the upgrade.