Compute Engine Google Cloud

How to Upgrade to Ubuntu 18.04 Bionic Beaver

How to Upgrade to Ubuntu 18.04 Bionic Beaver. Ubuntu Bionic Beaver is the latest operating system with Long Term Support (LTS).

This guide helps you how to upgrade to the latest Ubuntu 18.04. You might be having Ubuntu 16.04 with sudo privileges. This setup is tested on Google Cloud and this will work with other servers too.

Backup Your System

To make sure you wont lose any data, it’s recommended to create a backup of your system before upgrading. There are many options to take a backup in Google Cloud. You can create a new image of your disk or new snapshot. How to Backup Google Cloud Compute Engine.

Update Packages

Go your SSH terminal and perform the following steps on by one.

Before upgrading your operating system it’s necessary to update all current packages to their latest version.

sudo apt-get update
sudo apt-get upgrade

Once completed again upgrade the packages which involves the changes in dependencies.

sudo apt-get dist-upgrade

Once upgrading your packages is complete you can start to upgrade your Ubuntu OS.

Create a Firewall Rule

As upgrade procis started on port 1022 you need to allow connections on this port, so create a firewall rule in Google Cloud.

So go to VPC Network >> Firewall rules and create a firewall rule.

Provide a name.

In Targets select All instances in the network

In Source IP ranges enter 0.0.0.0/0

In Protocols and ports check tcp and enter 1022

Click Create.

Get back to your SSH terminal.

If you are using UFW perform this below step to allow connections on this port in your firewall.

sudo ufw allow 1022

Upgrade Ubuntu

To upgrade your system you can use the do-release-upgrade tool. This tool checks for the latest new release and make the upgrade safer and easier.

Start the upgrade by running the following command.

sudo do-release-upgrade

You will be prompted to continue the process, type y followed by Enter to continue.

Output
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] y

Now you will be prompted to allow connections on port 1022

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]

Click Enter to continue.

Now the upgrade tool will calculate the changes and provide you the prompt to continue or exit.

Calculating the changes

MarkInstall libpam-cap [ amd64 ] < none -> 1:2.25-1.2 > ( libs ) FU=1

Do you want to start the upgrade?

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

4 packages are going to be removed. 94 new packages are going to be installed.

426 packages are going to be upgraded.

You have to download a total of 198 M. This download will take about 25 minutes with a 1Mbit DSL connection and about 7 hours with a 56k modem.

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

Continue [yN] Details [d]

Enter y followed by Enter to continue.

This will take some time to complete the upgrade process. Once the process is completed you will be prompted to remove the obsolete packages.

Output
Remove obsolete packages?

29 packages are going to be removed.

Continue [yN] Details [d]

Enter y followed by Enter to continue.

Now upgrade will get competed and you need to restart your system for the changes to take effect.

Output
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]

Enter y followed by Enter to continue.

Now your connection to the terminal will disconnect. After reboot when you access the SSH you will be greeted with the Bionic Beaver welcome message.

Output
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-1026-gcp x86_64)

Now your Ubuntu system is upgraded to 18.04 LTS Bionic Beaver.

Cloudbooklet builds a large collection of Linux based guides and tutorials on Cloud platforms like Google Cloud, AWS, Azure, DigitalOcean and more

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

If you find this helpful? Support me!
Buy me a coffee Donation Please buy me a coffee