For example, I will upgrade Ubuntu Server 20.04 to version 22.04.
Switch to the root user:
Let’s see the current version:
lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.5 LTS Release: 20.04 Codename: focal
Update the installed packages and reboot the system:
apt update apt upgrade reboot
Remove unused packages:
Now you can start updating your Ubuntu version:
If the current system has third-party repositories configured that are not compatible with the new version of Ubuntu, then they will be automatically disabled, for example, I had the Zabbix repository disabled, which I then reinstalled but under the new version of Ubuntu.
When asked whether to restart services, I answered “Yes”.
On the server I was upgrading, I had Asterisk, nginx, php and many other services installed.
We agree with the proposal to remove obsolete packages.
Accept the reboot request at the end of the update process.
Done, after rebooting, let’s see the Ubuntu version again: