How to upgrade from Ubuntu 16.04 to 18.04

s2 0

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


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

Back up your data

First and foremost, make sure you back up your data before you begin your major operating system upgrade. If you’re running Ubuntu in a virtual machine, the best thing to do is to take a full system snapshot so that you can easily restore your computer in the event that the update gets too far.

Update currently installed packages

Before starting the release upgrade, it is recommended that you upgrade all currently installed packages to the latest versions.

sudo apt updatesudo apt upgrade

We’ll run too dist-upgrade This will upgrade the major version of the installed packages and may remove some unnecessary packages:

sudo apt dist-upgrade

Update Ubuntu 16.04 to Ubuntu 18.04

Ubuntu offers a tool called do-release-upgrade which makes the upgrade a fairly straightforward process.

The tool should already be installed on your system, but if for some reason it is not installed, you can install it using:

sudo apt install update-manager-core

How to start the upgrade run do-release-upgrade:

sudo do-release-upgrade

If, like me, you are updating your system via SSH, you will be asked if you want 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 an 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
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 has downloaded the package list and calculated the changes, you will be asked if 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.

Tap again y and the upgrade process will start.

During the upgrade process, you will be asked various questions, such as: For example, whether you want to keep an existing configuration file or install the maintainer version. Unless you have made any custom changes to the file, typing should be safe Y otherwise, enter the current configuration to keep the current configuration 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 on 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 outdated software if you are not sure d and check the list of obsolete packages, in most cases it is safe to enter them 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 everything went well, you will be prompted to restart your computer. Type y keep going:

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 a moment for your server to restart, then connect again. 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 with 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).