In this article, we want to teach you How To Upgrade or Update Ubuntu 18.04 to 20.04 From CLI.
Long-Term Support (LTS) release is normally associated with an application or an operating system for which you will get security, maintenance, and feature updates for a longer duration of time.
Ubuntu 20.04 is the latest Ubuntu LTS release, with security patches and updates available until 2025.
In this guide, you will learn to upgrade your Ubuntu 18.04 to 20.04 from the command line using the Linux commands.
Steps To Upgrade Ubuntu 18.04 to 20.04 From CLI
Before you start to complete this guide, you need to log in to your Ubuntu 18.04 as a root or non-root user with sudo privileges.
Now follow the steps below to update your Ubuntu 18.04 to 20.04 LTS.
Get backup from Ubuntu 18.04
First, it is important to make a backup from your server before you start to upgrade it.
Note down your Ubuntu Linux version with the following command:
Output No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04 LTS Release: 18.04 Codename: bionic
Next, you need to note down your Linux kernel version too with the command below:
Output Linux 4.15.0-22-generic x86_64
Update and Upgrade all packages on Ubuntu 18.04
At this point, you need to update and upgrade your local package index on Ubuntu with the following commands:
# sudo apt update # sudo apt list --upgradable # sudo apt upgrade
During your upgrading the server you will be asked to restart the services without asking, press yes to continue, and keep the local version currently installed.
When your updating and upgrading your Ubuntu 18.04 is completed, you need to reboot your server with the command below:
Then, you need to remove the unused old kernels with the following command:
sudo apt --purge autoremove
Next, you need to make sure that you install the update-manager-core package:
sudo apt install update-manager-core
Now you can start to upgrade your Ubuntu 18.04 to the latest LTS release.
Upgrade Ubuntu 18.04 to 20.04
To upgrade your Ubuntu version to 20.04, you need to run the do-release-upgrade command:
If you get the following message, you need to run the command above with the -d option:
Checking for a new Ubuntu release There is no development version of an LTS available. To upgrade to the latest non-LTS develoment release set Prompt=normal in /etc/update-manager/release-upgrades.
sudo do-release-upgrade -d
During the upgrading, you will be asked some questions. Just press y to continue, and keep the local version currently installed. Also, you need to choose your GRUB installation location and press ok.
When you are finished, restart your server to complete your upgrading.
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] y
After restarting, you can check your Ubuntu Linux version to see that you have successfully upgraded Ubuntu 18.04 to 20.04:
Output No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.04 Codename: focal
Also, you can verify the Linux Kernel version:
Output Linux 5.4.0-100-generic x86_64
At this point, you learn to Upgrade Ubuntu 18.04 to 20.04 From CLI.
Hope you enjoy it.
May you will be interested in these articles too:
How To Convert Centos 8 to AlmaLinux 8.