By now, Ubuntu Server 18.04.1 has been released. That .1 is the point at which most users are willing to finally upgrade to a major release. And considering 18.04 is a Long Term Support release, it’s certainly worth making the shift.
With that in mind, there are two routes to go: You can do a fresh install or upgrade. Many may cringe at the thought of upgrading, thinking a fresh install is the only safe way to go. And, for the most part, I recommend that same path (as you never know what could go wrong). However, I upgraded many a Ubuntu server (even across major releases), and rarely encountered a problem.
That, of course, doesn’t mean you won’t (so always consider what you’re working with, and your goals before running an upgrade).
Regardless of how safe you feel about running an upgrade, always do a complete, bare-metal backup–just in case.
SEE: Quick glossary: Storage (Tech Pro Research)
With those warnings said, let’s talk methods of upgrading. Since we’re discussing Ubuntu Server, we’ll use command line only. There are two methods of doing this: The recommended method and the not-so-recommended method. I only want to point out the not-so-recommended method on the off-chance there are those still doing this old-school path to upgrading (and as a fall-back).
And now, with the methods.
I used to upgrade Ubuntu desktops and servers by editing the /etc/apt/sources.list file. First, I’d run sudo apt-get update, followed by sudo apt-get upgrade, and then change the current release to the new release. So, if you were upgrading from Xenial Xerus (16.04) to Bionic Beaver (18.04), it would be necessary to change all references (within /etc/apt/sources.list) of xenial to bionic. Once you completed that, run the sudo apt-get update and sudo apt-get upgrade commands and wait for the process to complete.
Back in the day, that system worked pretty well. That method, of course, is no longer recommended. In fact, using that method will most likely land you in trouble, as you’ll find small things that may not work as expected.
This method is referred to as the Debian method of upgrading (or Brute Force Method). It does work consistently in Debian, but not in Ubuntu. In fact, that is the recommended method of upgrading Debian.
The biggest issue you’ll find with this method is that some third-party repositories might not have the channel for the destination version you are upgrading to, which can lead to problems.
SEE: Open source vs. proprietary software: A look at the pros and cons (Tech Pro Research)
The recommended method
Let’s talk about the recommended upgrading method. The Ubuntu developers included a single command that takes care of everything for you (once you’ve run sudo apt-get update and sudo apt-get upgrade). That command is:
What the above command does is:
- Properly changes the sources
- Removes obsolete entries
- Updates packages index
- If there are unsupported, third-party repositories, disables them
- Downloads and installs the upgrade
- Removes any orphan/old packages
This method of upgrading does take some time, and you should (of course) do it outside of business hours. sometimes this method does require your input (in the event that the command needs to know what you want to do with a certain upgrade or configuration file).
What to do upon failure
One of the best things about do-release-upgrade (besides it being an easy route to upgrading releases) is that, it runs tests to make sure it can succeed. You’ll know the tests succeeded when the command asks you if you want to continue with the upgrade (Figure A).
Should those tests fail, the upgrade will abort. In the event this method fails (and it does at times), your best route of upgrading is the Debian Method. However, I suggest (should do-release-upgrade fail) that your best method is a clean installation.
If you are running a clean install, make sure you have a complete copy of all your data from the server (or, better yet, install the new version on a different server/virtual machine, and then migrate from one to the other).
LTS all the way
Make sure you’re running an LTS version of Ubuntu on your data center servers. Why? Because these releases are supported for five years. That means (in theory) you could install Ubuntu 18.04 now (2018) and not have to upgrade it to the next LTS version until 2023. That’s quite a long time in tech years. Even then, you could (again, theoretically) run sudo do-release-upgrade in 2023 and upgrade Ubuntu 18.04 to Ubuntu 23.04.
That’s a pretty safe route to go.
- How to keep your Ubuntu Linux systems updated with uCaresystem (TechRepublic)
- How to install the Dolibarr ERP/CRM on Ubuntu 18.04 (TechRepublic)
- How to install HTTP Git Server on Ubuntu 18.04 (TechRepublic)
- Ubuntu 18.04 LTS: The Linux for AI, clouds, and containers (ZDNet)
- The best way to update and install apps on Ubuntu (TechRepublic)
- Microsoft PowerShell now available on Linux as an Ubuntu snap (ZDNet)
- Mark Shuttleworth dishes on where Canonical and Ubuntu Linux are going next (ZDNet)