Read in 4 minutes

last updated 

How To Upgrade Ubuntu To 18.04 (Bionic Beaver)

The latest Ubuntu LTS release, Ubuntu 18.04 (Bionic Beaver), was released on April 26, 2018 and it will be supported for 5 years until April 2023. In this tutorial we will show you how to upgrade your Ubuntu 16.04 installation or later to Ubuntu 18.04 (Bionic Beaver).

Prerequisites

Before starting with the tutorial, make sure you are logged in as a user with sudo privileges.

Backup Your Data

First and foremost, make sure you backup your data before starting the major upgrade of your operating system. If you are running Ubuntu on a virtual machine it is best to take a complete system snapshot so you can easily restore your machine in case the update goes south.

Update Currently Installed Packages

Before starting the release upgrade, it is recommended to update all your currently installed packages to their latest versions.

sudo apt update
sudo apt upgrade

We will also run dist-upgrade which will perform a major version upgrade of the installed packages and may remove some unnecessary packages:

sudo apt dist-upgrade

Upgrade Ubuntu 16.04 to Ubuntu 18.04

Ubuntu provides a tool called do-release-upgrade which makes the upgrade a pretty straightforward process. The tool should already be installed on your system but if for some reason it is not installed you can install it with:

sudo apt install do-release-upgrade

To start the upgrade run do-release-upgrade:

sudo do-release-upgrade

If you are upgrading your system over SSH like me, you will be asked whether you wish 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]
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 upgrade tool downloads the packages list and calculate the changes it will ask you whether you want to continue

Do you want to start the upgrade?


4 installed packages are no longer supported by Canonical. You can
still get support from the community.

3 packages are going to be removed. 90 new packages are going to be
installed. 397 packages are going to be upgraded.

You have to download a total of 267 M. This download will take about
1 minute with your connection.

Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.

Once again type y and the upgrade process will start.

During the upgrade process, you will be asked various questions, like whether you want to keep an existing configuration file or to install the package maintainer’s version. If you didn’t make any custom changes to the file it should be safe to type Y otherwise to keep the current configuration enter N.

Configuration file '/etc/sysctl.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** sysctl.conf (Y/I/N/O/D/Z) [default=N] ?

The upgrade process may take some time depending of the number of updates and your Internet speed.

Once the new packages are installed, the update tool will ask you if you want to remove the obsolete software, if you are not sure type d and check the list of obsolete packages, in most cases it is safe to enter y and remove all obsolete packages:

Searching for obsolete software
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading state information... Done

Remove obsolete packages?


17 packages are going to be removed.

Once the upgrade process is complete and assuming all went well, you’ll be asked to reboot your machine. Type 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] y

Confirm the update

Wait for a few moment until your server reboot and then reconnect. After logging in you will be greeted with the following message:

Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-20-generic x86_64)

You can also check the Ubuntu version by using the following command:

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

That’s it, you can now enjoy your new Ubuntu 18.04 LTS (Bionic Beaver).