Home Ubuntu How To Upgrade To Ubuntu 20.04 LTS Server

How To Upgrade To Ubuntu 20.04 LTS Server

By sk
Published: Updated: 16K views

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.

Prerequisites

Before upgrading to latest Ubuntu version, we must take care of some important things first.

1. 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.

2. 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:

$ screen

If your SSH connection is broken when upgrading, you can re-attach to the upgrade session easily with command:

$ screen -Dr

3. 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.

[...]
Prompt=lts
Default behavior for the Ubuntu release upgrader

If you’re upgrading from Ubuntu 19.10 to 20.04 LTS, set prompting behavior as normal.

Save and close the file.

Upgrade To Ubuntu 20.04 LTS Server

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]
Ubuntu upgrade process running under SSH session
Ubuntu upgrade process running under SSH session

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

Or,

# 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:

Additional sshd will be started during Ubuntu upgrade process
Additional sshd will be started during Ubuntu upgrade process

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.

Start Ubuntu 20.04 LTS server upgrade
Start Ubuntu 20.04 LTS server upgrade

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.

Restart services during package upgrades without asking
Restart services during package upgrades without asking

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]
Ubuntu 20.04 server upgrade is completed
Ubuntu 20.04 server upgrade is completed

Log in to the newly upgraded Ubuntu 20.04 LTS system:

Ubuntu 20.04 LTS Server
Ubuntu 20.04 LTS Server

You can check verify the Ubuntu version using command:

$ lsb_release -a

Sample output:

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.

Troubleshooting

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.

You May Also Like

1 comment

Jon November 4, 2021 - 7:48 am

Thanks. I’d tried this 3 times before, but something always went wrong. With your help, I finally got all the way through.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More