Ubuntu 20.04 LTS (Focal Fossa) was released on Apr 23, 2020. This LTS (Long Term Support) flavor will be supported until 2025. As usual, the Standard release will be supported for just one year. The Ubuntu Desktop users can upgrade to the latest version immediately, however, it is advised that the Ubuntu server production users wait for the few months before upgrading to Ubuntu 20.04 LTS.
For those who are ready to go ahead and upgrade then this tutorial will show you how to upgrade Ubuntu 18.04 LTS to Ubuntu 20.04 LTS via command line. So let’s get started.
Step 1: Backup Your Data
It is strongly recommended to backup all your data from Ubuntu Desktop or Server to a remote location or external disk before attempting any upgrades. If you are on a cloud service or running off a VM you may also take a complete system snapshot if possible.
Note: Remember that it’s safest to perform major operating system upgrades only when you have direct physical access to the machine. If using SSH, for virtual machines or managed servers you should keep in mind that losing SSH connectivity is a risk. Ensure you have another means of accessing the server such as a web-based console feature, for example.
Step 2: Update Currently Installed Packages
We need to make sure all the installed packages are updated. Begin by updating the package list:
$ sudo apt update
Now we can upgrade installed packages to their latest available versions:
$ sudo apt upgrade
You will be shown a list of upgrades and prompted to continue. Agree to the prompts to begin the upgrades.
Once it finished use the dist-upgrade command which will perform any additional upgrades such as changing dependencies, adding or removing new packages as necessary.
$ sudo apt dist-upgrade
Again, answer y when prompted to continue, and let the process run its course. You are now ready to begin the upgrade from Ubuntu 18.04 LTS to Ubuntu 20.04 LTS.
Step 3: Upgrade to Ubuntu 20.04 LTS
Here we will use the tool called do-release-upgrade to make the upgrade safer and easier. do-release-upgrade is the officially recommended upgrade path for server upgrades which must be performed over a remote connection. The tool handles checking for a new release, updating sources.list, and a range of other tasks. proceed by running the following command:
$ sudo do-release-upgrade
If you get the following output, it means the new Ubuntu version has not been officially released yet.
Checking for a new Ubuntu release
No new release found
On Ubuntu Server, the new LTS release isn’t made available to do-release-upgrade until its first point release, which is Ubuntu 20.04.1. This usually comes a few months after the initial release date.
If you still want to upgrade without waiting you can install a development release by adding the -d option:
$ sudo do-release-upgrade -d
If you’re connected to your system over SSH, you will be asked whether you wish to continue. At the prompt, type y and press Enter to continue:
Reading cache Checking package manager Continue running under SSH? This session appears to be running under ssh. It is not recommended to perform a upgrade over ssh currently because in case of failure it is harder to recover. If you continue, an additional ssh daemon will be started at port '1022'. Do you want to continue? Continue [yN]
Next, you will be informed that do-release-upgrade is starting a new instance of ssh on port 1022:
Starting additional sshd To make recovery in case of failure easier, an additional sshd will be started on port '1022'. If anything goes wrong with the running ssh you can still connect to the additional one. If you run a firewall, you may need to temporarily open this port. As this is potentially dangerous it's not done automatically. You can open the port with e.g.: 'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT' To continue please press [ENTER]
Once the new package lists have been downloaded and processed, you’ll be asked if you want to start the upgrade. Enter y to continue:
Do you want to start the upgrade? 18 installed packages are no longer supported by Canonical. You can still get support from the community. 3 packages are going to be removed. 142 new packages are going to be installed. 452 packages are going to be upgraded. You have to download a total of 338 M. This download will take about 42 minutes with a 1Mbit DSL connection and about 13 hours with a 56k modem. Fetching and installing the upgrade can take several hours. Once the download has finished, the process cannot be canceled. Continue [yN] Details [d]
The upgrade will now proceed and this process will take a while. keep an eye on the process during the installation as you may be presented with interactive dialogs that will require your action to process and make choices.
You will have to make the right calls based on your current preferences in each case. In most cases, you will answer ‘yes‘ or you will opt to keep the current configuration.
Once new packages have finished installing, you will be asked whether you are ready to remove obsolete packages. On a stock system with no custom configuration, it should be safe to enter y here. On a system you have modified heavily, you may wish to enter d and inspect the list of packages to be removed, in case it includes anything you will need to reinstall later.
Remove obsolete packages? 53 packages are going to be removed. Continue [yN] Details [d]
Finally, assuming all has gone well, you will be asked to restart the system. Enter y to continue:
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]
Give your server a moment to reboot, then reconnect.
You should now have a working Ubuntu 20.04 installation. It is also good practice to investigate necessary configuration changes to services and deployed applications to ensure everything is still working as expected.