1. Let’s fetch the latest version of the package list from the repositories.
sudo apt update
2. Upgrade the installed packages.
sudo apt upgrade
3. Upgrade the distribution and reboot the server.
sudo apt dist-upgrade
4. Let’s make sure we have the Update Manager Core installed.
sudo apt install update-manager-core
5. Let’s make sure we upgrade to only the latest lts version.
make sure `prompt` is set to lts
sudo vim /etc/update-manager/release-upgrades
6. Now upgrade the server.
sudo do-release-upgrade -d