How to Upgrade Ubuntu 12.04 to 14.04
Operating system upgrades are risky. If something goes wrong during the update, your entire server and all of your data on it may be lost.
Preparing to Upgrade
Important: Take a server snapshot at your provider before upgrading.
Once you've taken a snapshot of your server, SSH in to your server as root and run the following commands to make sure your server is ready to be upgraded to a new version of Ubuntu.
sudo apt-get update && sudo apt-get dist-upgrade sudo dpkg --configure -a
If any of the above commands fail or print error messages, do not proceed with upgrading to a newer Ubuntu version.
Next, run the following command to remove any conflicting apache2 packages in case you ever accidentally installed them while customizing your server:
sudo apt-get remove apache2 apache2-bin apache2-data
Performing the Upgrade
To upgrade your Ubuntu 12.04 server to Ubuntu 14.04, SSH in to your server as root and run the following command:
sudo do-release-upgrade -f DistUpgradeViewNonInteractive
If the upgrade completes without errors, take a new snapshot of your server so you'll have a snapshot of the server after the upgrade.
If the upgrade fails or encounters any errors, restore your server to the snapshot you made before you began the upgrade.
Last updated: February 23, 2017