Upgrade Ubuntu 18.04 to 20.04 in Command Line
Ubuntu 20.04 is the latest version of the Ubuntu stable release. If you have an Ubuntu 18.04 Server/Desktop, now it’s time to upgrade to Ubuntu 20.04.
Upgrading Ubuntu is a two-step process. First, we would upgrade all installed packages to their most recent version using the apt dist-upgrade
command. Next, we will run the do-release-upgrade
command to Upgrade Ubuntu 18.04 to 20.04 LTS.
Let’s see how to do it in the command-line interface
Note that upgrading Ubuntu via remote access (SSH) is not advised. Use direct access whenever possible or the virtual machine console if you are updating an Ubuntu Virtual machine.
We begin by obtaining an updated list of packages from the Ubuntu repository:
sudo apt update
Next, upgrade all packages to the latest version using the dist-upgrade
command:
sudo apt dist-upgrade
Reboot Ubuntu after updating packages:
sudo systemctl reboot
After the reboot, run the do-release-upgrade
command to upgrade to Ubuntu 20.04 LTS:
sudo do-release-upgrade
The update process can take several hours and should not be interrupted during that time.
This is the recommended way to upgrade Ubuntu from the command-line. After the upgrade, run the lsb_release -a
command to check the ubuntu version.