How to Upgrade Ubuntu Server from 18.04 to 20.04 Version

Ubuntu is widely popular Linux Operating System. Its latest release is Ubuntu 20.04 LTS with new kernel and new features. In any situation you might need to upgrade your Ubuntu LTS server. In this guide, We’ll show you the steps to upgrade Ubuntu server version from 18.04 to 20.04 LTS.

This ubuntu upgrade process usually takes time which results downtime. If you are running a web service like apache2 or some other public facing service then be prepared for your services to be offline for some duration. This is the reason you should upgrade to the new version when it is really critical.

Second thing is to take backup of your server. We use AWS cloud platform for my servers and creating a backup of the entire server image is just a matter of a few clicks.

Prerequisite

  • Ubuntu Machine with Prior versions of 20.04 LTS
  • root user privileges.
  • Good Internet Connection

Step 1: Updating your system

It is recommended to update your Ubuntu server first for any pending software updates,

# apt update && apt dist-upgrade -y

Step 2: Configuring Update Manager

Ubuntu provides a tool called Update Manager for upgrading your system to the newer version. Normally, it should already be installed but you should verify that your Ubuntu server has update manager tool installed in it.

# apt install update-manager-core

Now, you should check the content of the /etc/update-manager/release-upgrades file and make sure that the last line is Prompt=lts and it is not commented out. This means that your Ubuntu system gonna updated to a new stable LTS version. It looks something like this:

ubuntu upgrade to 20.04

Step 3: Upgrading Ubuntu server to a newer LTS version

Once you made sure of that, you can upgrade your Ubuntu 18.04 server to Ubuntu 20.04 LTS with the below command,

# do-release-upgrade

You may get a message like below that says it cannot find a new version to upgrade to.

Checking for a new Ubuntu release
There is no development version of an LTS available.
To upgrade to the latest non-LTS development release
set Prompt=normal in /etc/update-manager/release-upgrades.

You can force the upgrade using -d option like below,

# do-release-upgrade -d

The -d option will force to check for development release which is 20.04 we are looking for.

Upgrading Ubuntu server over SSH connection

If you are using SSH to log in to your system, you will get a warning message as follows,

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.

The ubuntu version upgrade process requires your input at several steps. If you are doing it over SSH and your connection gets disconnected, what will happen to the upgrade? Will it hang? How will it get the critical user input to proceed with the upgrade?

No worries. Ubuntu is intelligent enough. The do-release-upgrade tool takes care of this. It will automatically open a new ssh session with screen at port 1022 . If you have custom firewall in your system then  you should open the tcp 1022 port .

# iptables -I INPUT -p tcp --dport 1022 -j ACCEPT

If you get disconnected in the middle of the upgrade from the server, you can reconnect it and recover the session by connecting to your server through ssh but at port 1022 like this:

# ssh [email protected]_ip_address -p 1022

If you can’t see the upgrade procedure running, use the screen command as follows:

# screen -x

Follow the on screen instructions and you should be able to upgrade to the new server in around 20-30 minutes.

ubuntu upgrade to 20.04

After the upgrade finished, you have to restart your Ubuntu server. You can verify if you are using Ubuntu 20.04 with lsb_release -a command as follows,

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal

Conclusion

In this guide, you learnt How to upgrade ubuntu server from 18.04 to 20.04 version. I hope you liked this quick little tutorial helpful to upgrade your server to Ubuntu 20.04 LTS server.

Read Also : Install FREE SSL/TLS Certificate on Apache with Let’s Encrypt on Ubuntu 18.04/20.04

Share on:

Ravindra Kumar

Hi, This is Ravindra. I am founder of TheCodeCloud. I am AWS Certified Solutions Architect Associate & Certified in Oracle Cloud as well. I am DevOps and Data Science Enthusiast.

Recommended Reading..

Leave a Comment