Like almost everything in Linux, there’s a nice easy way to upgrade an existing Ubuntu installation to the latest version of the Operating System from a command line interface. And it can all be done in just a few simple steps. The most important of all, remembering to backup all that important data before even thinking of getting started with any upgrade – of course.
The next step, after backing up, is checking that ‘update-manager-core’ is installed on the target machine:
sudo apt-get install update-manager-core
Now edit your ‘release-upgrades’ file to tell the update-manager that you want to receive all major operating system upgrades.
sudo nano -w /etc/update-manager/release-upgrades
You will need to change prompt=lts to prompt=normal if it is not already set this way. Save and exit nano.
Next you need to make sure your system has all the current updates for the version of Ubuntu you are running right now:
sudo apt-get update && sudo apt-get upgrade
If apt confirms your system is up-to-date, we’re good to go. (we did make current backups of all our data right?)
To start the Ubuntu upgrade process, issue the following command:
sudo do-release-upgrade
If you’re connected remotely using a terminal connection, Ubuntu will inform you this is risky and that a separate SSH server instance has been opened on port 1022. This, in theory, should allow you to connect to your machine in the event something goes wrong – and your default SSH server has died.
If all goes well, your machine should be upgraded to the current version of Ubuntu within about 30 minutes – depending on the speed of your internet connection.
These instructions were written for Ubuntu upgrades from 10.04 LTS to 12.04 LTS. These may no longer work for newer versions of Ubuntu, and may need updating in the future.