How to Upgrade Ubuntu 20.04 from Ubuntu 18.04 and 19.04

First, Check that your system is up to date by running the following commands.

apt-get dist-upgrade -y 

Output:

root@vps:~# apt-get dist-upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
    amd64-microcode intel-microcode iucode-tool
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
    linux-headers-4.15.0-96 linux-headers-4.15.0-96-generic
The following packages will be upgraded:
    distro-info-data git git-man kmod libkmod2 libpython3.6 libpython3.6-minimal
    libpython3.6-stdlib linux-headers-generic lxcfs open-vm-tools
    python3-update-manager python3.6 python3.6-minimal sosreport
    update-manager-core
16 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.2 MB of archives.

Once all updates are installed,Then install update-manager-core package if it is not already installed.

apt-get install update-manager-core

Output:

root@vps:~# apt-get install update-manager-core
Reading package lists... Done
Building dependency tree
Reading state information... Done
update-manager-core is already the newest version (1:19.04.5).
update-manager-core set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Go to last line of /etc/update-manager/release-upgrades configuration file is set to ‘lts' if you only want LTS upgrades (for Ubuntu 18.04 users) or to 'normal' if you want non-LTS upgrades (for Ubuntu 19.10 users).

eg: Output of ubuntu 18.04

vi /etc/update-manager/release-upgrades

Output:

# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting and upgrade behavior, valid options:
#
#  never  - Never check for, or allow upgrading to, a new release.
#  normal - Check to see if a new release is available.  If more than one new
#           release is found, the release upgrader will attempt to upgrade to
#           the supported release that immediately succeeds the
#           currently-running release.
#  lts    - Check to see if a new LTS release is available.  The upgrader
#           will attempt to upgrade to the first LTS release available after
#           the currently-running one.  Note that if this option is used and
#           the currently-running release is not itself an LTS release the
#           upgrader will assume prompt was meant to be normal.
Prompt=lts

Now launch the upgrade tool by running the following command. While running the command it'll ask you to confirm. press "y" to confirm the upgrade.

do-release-upgrade -d

Output:

root@vps:~# do-release-upgrade -d
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [1,554 B]
Get:2 Upgrade tool [1,344 kB]
Fetched 1,346 kB in 0s (0 B/s)
authenticate 'focal.tar.gz' against 'focal.tar.gz.gpg'
extracting 'focal.tar.gz'
s://wiki.debian.org/Teams/Dpkg/FAQ>
(Reading database ... 77184 files and directories currently installed.)
Purging configuration files for libssl1.0.0:amd64 (1.0.2n-1ubuntu5.3) ...
Purging configuration files for ureadahead (0.100.0-21) ...
Purging configuration files for libpython3.6-minimal:amd64 (3.6.9-1~18.04ubuntu1) ...
Purging configuration files for linux-modules-4.15.0-20-generic (4.15.0-20.21) ...
Purging configuration files for python3.6-minimal (3.6.9-1~18.04ubuntu1) ...
Purging configuration files for linux-image-unsigned-4.15.0-20-generic (4.15.0-20.21) ...
rmdir: failed to remove '/lib/modules/4.15.0-20-generic': No such file or directory

Select latest version and click "OK".

Select the openssh configuration as you required.

System upgrade is complete.

Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Continue [yN] N

Press "y" to restart.

After a restart, login and check the current Ubuntu version on your server by running following command.

cat /etc/lsb-release

Output:

root@vps:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS"