How To Upgrade To Ubuntu 20.04 LTS Server
We’ve already shown you how to upgrade to Ubuntu 20.04 LTS desktop from Ubuntu 18.04 LTS or Ubuntu 19.10 desktop systems. Now let us see how to upgrade to Ubuntu 20.04 LTS server from Ubuntu 18.04 LTS or Ubuntu 19.10 server with screenshots. The method of upgrading between LTS releases and normal edition to LTS is quite same, except a small change in Ubuntu release upgrader.
Before upgrading to latest Ubuntu version, we must take care of some important things first.
Backup Important Data
First of all, It is strongly recommended to backup your important data, configuration files, and anything that you can’t afford to lose.
Update Your Current Ubuntu System
Next, update your current Ubuntu server:
$ sudo apt update && sudo apt dist-upgrade
Once the update is completed, reboot it to apply the updates.
$ sudo reboot
I strongly recommend everyone to use Screen tool when attempting to upgrade a remote server via SSH. This will keep running the upgrade the process in case your SSH session is dropped for any reason.
To install the screen tool, Enter:
$ sudo apt-get install screen
Once it’s installed, start the screen session with command:
If your SSH connection is broken when upgrading, you can re-attach to the upgrade session easily with command:
$ screen -Dr
Setting up software sources
Install the “update-manager-core" and "ubuntu-release-upgrader-core" packages if they are not installed already:
$ sudo apt install update-manager-core
$ sudo apt install ubuntu-release-upgrader-core
Then, edit the file /etc/update-manager/release-upgrades,
$ sudo nano /etc/update-manager/release-upgrades
If you’re upgrading from Ubuntu 18.04 LTS to 20.04 LTS, you need to set prompting behavior for for the release upgrader as lts.
If you’re upgrading from Ubuntu 19.10 to 20.04 LTS, set prompting behavior as normal.
Save and close the file.
Now, start the upgrade process with command:
$ sudo do-release-upgrade -d
If you’re running the upgrade process under SSH session, the following warning message will appear. Just type “y” to continue.
[...] 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]
Now, an additional sshd will be started on port ‘1022’ to make recovery easier, just in case of failure. 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 the commands:
# iptables -I INPUT -p tcp --dport 1022 -j ACCEPT
# ufw allow 1022
If you are running the Upgrade on a local server, you need not to do the above steps.
Again press ENTER to continue:
After a few seconds, the upgrade wizard will display the summary of how many packages are going to be removed, how many packages will be upgraded, how many new packages are going to be newly installed and the total download size.
Press “y” to start the upgrade process. This will take a while to complete depending upon the speed of your Internet connection.
During the upgrade process, some services installed on your system need to be restarted when certain libraries are upgraded. Since these restarts may cause interruptions of service for the system, you will normally be prompted on each upgrade for the list of services you wish to restart. You can choose this option to avoid being prompted; instead, all necessary restarts will be done for you automatically so you can avoid being asked questions on each library upgrade.
To automatically restart the services during package upgrades without asking, choose “Yes” and press ENTER to continue.
Once the upgrade is complete, you would see the following message. Press “y” to complete Ubuntu upgrade process and restart the server:
[...] 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]
Log in to the newly upgraded Ubuntu 20.04 LTS system:
You can check verify the Ubuntu version using command:
$ lsb_release -a
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal
Congratulations! Start using Ubuntu 20.04 LTS server edition.
Just in case if your Ubuntu system is crashed due to power failure or network connectivity issue in the middle of the Upgrade process, you might end up with broken Ubuntu. In such cases, refer the following guide to fix it.