How To Upgrade From Ubuntu 16.04 to Ubuntu 18.04

Ubuntu 18.04 or Bionic Beaver is available since April 2018! If you want to upgrade your older Ubuntu version to this one you need to perform several simple steps:

Note: Users of Ubuntu 16.04 LTS: you can't upgrade to 18.04 LTS through 'do-release-upgrade' until 18.04.1 (late July) instead you need to use: 'do-release-upgrade -d' which is considered as upgrade to development version.

Update: Since mid August you can update Linux server 16.04 to Linux Server 18.04 with command:

sudo do-release-upgrade

After the update you will see information like:

Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.17.14-x86_64-linode114 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

 * Read about Ubuntu updates for L1 Terminal Fault Vulnerabilities
   (L1TF).

   - https://ubu.one/L1TF

 * Check out 6 great IDEs now available on Ubuntu. There may even be
   something worthwhile there for those crazy EMACS fans ;)

   - https://bit.ly/6-cool-IDEs
Last login: Thu Aug 16 06:22:36 2018 from 78.83.70.186

There are 6 new ides for ubuntu: 6 IDEs you need to know about:

  • Visual Studio Code
  • Sublime Text
  • Android Studio
  • PyCharm
  • Simply Fortran
  • Postman

End of Update

The long-term support (LTS) edition Ubuntu 16.04 is supported until April 2021 and the current non LTS edition Ubuntu 17.10 is supported until July 2018. Which means that updates are available until 2021 for Ubuntu 16.04 LTS and July 2018 for Ubuntu 17.10. You can upgrade to the newest version only if you want to use new updated packages, new features and other major improvements in Ubuntu 18.04 LTS edition. For example my incentive to update from Ubuntu 16.04 to 18.04 is nginx package which is:

  • Ubuntu 16.04 - 1.10.3-0ubuntu0.16.04.2
  • Ubuntu 18.04 - 1.14.0-0ubuntu1

I want to move to newer nginx because of the new features which provides like:

Building and Loading PageSpeed as a Dynamic Module for NGINX

An many others packages has newer versions which could be a good reason to move to the newer version of Ubuntu.

Back up of your system

Depending on your case the back up steps will be different. The idea is that if you want to upgrade production machine then the back up is your first step. Many reasons can cause problems and stop of your service. Which is unacceptable for most modern services.

If you are using VPS providers like linode or DigitalOcean then you can make snapshots and use them as a backup. usually snapshots do a copy image of your entire VPS and store it on the server. Later you can redeploy your image on the same or different server instance.

You can also do back which is suggested in Ubuntu documentation:

Ubuntu BackupYourSystem

There are several types of backups:

  • manual - manual backup would be initiated on a schedule by the user
  • local automated - automated backups that target a hard drive attached to the physical box
  • remote automated - automated backups that target a hard drive over the network

Some points to consider with ubuntu back ups:

  • Extracting file or files is not possible/easy
  • incremental backups are not possible
  • Restore to a disk that is smaller than the original is not possible(never mind the free space)
  • Restoring to a larger disk may require additional steps

Update and upgrade of your packages

Updating the system and software packages can be done in several simple steps:

Prior upgrade to newer version or installing new software it's always good practice to update to the latest versions of all packages for the current release by:

sudo apt-get update

Next step is to upgrade newly installed software packages to latest available versions:

sudo apt-get upgrade

If any new packages you will be informed for the required space and asked if you want to perform this upgrade - answer y for yes and press Enter.

Next steps is:

sudo apt-get dist-upgrade

This will do some additional updates and upgrades like changing dependencies

Upgrade to Ubuntu 18.04 - Bionic Beaver

Usually the upgrade to newer version is done by:

sudo do-release-upgrade

The result could be:

Checking for a new Ubuntu release
No new release found

Which means that no new version are available. If you still want to upgrade to newer version than you can do(add option -d to upgrade to the development release):

sudo do-release-upgrade -d

If you are connected via SSH you will be informed for the risk on continuing ( this is the case for VPS - virtual private server where you don't have physical access to this machine). Of course if you have another way of connection to this machine you will be fine.

  • After typing y and press Enter to continue:
  • Information that do-release-upgrade starts a new instance of SSHD on port 1022
  • press Enter
  • You'll be asked if you want to start the upgrade. Again, enter y to continue
  • Once installation of new packages is completed, question about removing obsolete packages will appear
  • Warning will be shown that system upgrade is complete and restart is required
  • Enter y to continue

Note: During the update and upgrade you may asked with interactive dialogs for various questions like.

For SSH you may see message like:

Connection to XX.XX.XX.XX closed by remote host.
Connection to XX.XX.XX.XX closed.

Press any key in order to exit the local prompt and try to reconnect after waiting for some time.

After successful login in your system you will see:

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

Another way to check Ubuntu version is by typing in terminal:

  • Open the Terminal (keyboard shortcut: CTRL+ALT+T):
lsb_release -a

References

Related Article