How to upgrade from Ubuntu 18.04 LTS to 20.04 LTS

2021-09-01 By Aaron 3072 Views ubuntu upgrade
0 reviews

Keeping a server up-to-date with the latest security patches and updates available for the operating system is always a good practice. This helps in protecting the server against any vulnerabilities that were present in the older versions of the operating system.


Ubuntu 20.04 LTS (Focal Fossa) is the latest Long Term Support release with the security patches and updates being available till 2025. Hence, upgrading an Ubuntu system with an older LTS version (18.04 LTS) to the latest version is always a good option.


This guide outlines the basic steps for upgrading an Ubuntu 18.04 LTS server to Ubuntu 20.04 LTS.

IMPORTANT NOTE: Always make sure that the server data is backed up first before proceeding with such upgrade processes as there are high risks of data loss during such operations.


Preparing for the upgrade process


  1. Execute the below command to first check the version of Ubuntu installed in the server.

     # lsb_release -a
    

    upgradeubuntu1

  2. The first step to being performed before proceeding with the OS upgrade is to update and upgrade the server packages.

    Run the below command to update and upgrade the packages:

     # sudo apt update && sudo apt upgrade -y
    

    upgradeubuntu2

  3. Reboot the server once.

     # reboot
    
  4. Once the server is rebooted, run the below command to remove any unused packages and kernels.

     # apt --purge autoremove
    

    upgradeubuntu3

  5. Using any editor of choice, open the update manager configuration file.

     # vi /etc/update-manager/release-upgrades
    

    upgradeubuntu4

  6. Find the line starting with Prompt= and confirm that the line is not commented (prefixed by #). Make sure that the value is lts as below:

    upgradeubuntu5


Running the upgrade process

Before proceeding with the OS upgrade process, make sure that the server data is backed up, as interrupting the upgrade process in between can cause the system to become corrupt and unstable.


  1. Execute the below command to run the OS upgrade tool.

    In order to make sure that the upgrade process is not interrupted, it is recommended that this process be done through Console option of the server under LayerPanel.

     # do-release-upgrade
    

    upgradeubuntu14

  2. A brief summary of the number of packages that need to be installed, the total size of the data that needs to be downloaded as well as the approximate time required for the upgrade process to be completed will be shown at the end of the command execution.

    Type Y to proceed with the upgrade process:

    upgradeubuntu15

  3. The upgrade process will prompt for responses to be input for several questions such as below:

    a) Restart services during package upgrades without asking?

    Answer Yes: The services are automatically restarted during the upgrade process.

    Answer No: Each service will be prompted to be restarted during the upgrade.

    upgradeubuntu8

    b) Configuring LXD

    If not sure of which version is required, can select the 4.0 version:

    upgradeubuntu9

    c) Configuring openssh-server

    Select the option keep the local version currently installed:

    upgradeubuntu10

    d) Remove obsolete packages

    It is always recommended to remove the obsolete packages in the server to free up system resources. Type y to proceed:

    upgradeubuntu16

  4. Once the OS upgrade process is completed, a server reboot will be prompted. Type y to reboot the server.

    upgradeubuntu17

  5. Once the server has been rebooted, log in as root and verify the completion of the upgrade process by checking the current Ubuntu version on the server.

     # lsb_release -a
    

    upgradeubuntu13


Related Tutorials

What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.