Upgrade Ubuntu Server 16.04 to 18.04
The Ubuntu team will this week release Ubuntu Server 18.04.1, the first minor revision to 18.04 since its release on April 26th.
Following the release on July 26th*, Ubuntu 16.04 machines everywhere will soon start to get notifications that a new release is available to upgrade to.
In this article, I’ll show you how to upgrade Ubuntu 16.04 to 18.04 using the command-line. This can be used on all Ubuntu derivatives, but is mostly aimed at Server installs that do not have a graphical interface.
I’d highly recommend running these commands on the console of your server, if at all possible. You never know if you’ll get hit by a network outage in the middle of the upgrade!
Most cloud hosting companies provide access to a virtual server’s console. Look for a “remote console”, “VNC console” or “out-of-band console” option in your provider’s control panel. If you cannot access the console, you can run these commands just fine in an SSH session.
Prepare for the Upgrade
Before you begin, ensure you have a backup of the files and databases stored on your server! If your cloud host supports it, taking a snapshot is an ideal way to capture your server’s state before the upgrade. You can revert to the snapshot if it doesn’t go to plan.
Run the Upgrade
The command is a simple one:
If you see the output:
Checking for a new Ubuntu release No new release found.
Don’t panic! It just means the upgrade hasn’t been released yet. If you’re currently running an earlier LTS release, the upgrade to the new version isn’t made available until the first minor release some 3 months or so later.
If you want to upgrade anyway, run:
If you’re running under SSH, you’ll get prompted to continue:
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 confirmed, the update will analyse your system, update your repository configurations to the new release and prompt for your final confirmation to update.
3 installed packages are no longer supported by Canonical. You can still get support from the community. 4 packages are going to be removed. 123 new packages are going to be installed. 492 packages are going to be upgraded. You have to download a total of 292 M. This download will take about 37 minutes with a 1Mbit DSL connection and about 11 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]
After the new packages have been installed, you will be prompted to reboot into your new Ubuntu 18.04 system:
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]