How to upgrade Ubuntu Linux 16.04 LTS, 16.10 or 17.04 to Ubuntu 18.04 LTS inplace
To upgrade Ubuntu you often dont need to do a fresh install of it. You can try an inplace upgrade instead with only a few easy steps.
However its highly recommended that you first BACKUP ALL YOUR DATA AND CONFIGURATION FILES onto an external and offline storage device, like an USB drive or stick. Depending on how you drive your Ubuntu Installation, you should know where you stored your stuff locally. If not its a very good start to backup at least /home and /etc paths recursively. These contain usually most of the users data and the systems configuration files.
Then you can try an Ubuntu 18.04 LTS inplace upgrade by doing this:
CHECK YOUR BACKUPS!
Make sure you have a fresh backup of all your important files and data and that your backup archive/files are fine and readable! You might never need it, if anything goes fine. But the very moment something goes haywire, you will thank yourself for not skipping this step!!
Update your online repositories:
sudo apt update -y
Update/Upgrade your installed software to the latest versions:
sudo apt upgrade -y
safe do a reboot now. since there “could” have been kernel updates:
Handle software dependencies with new versions of packages:
sudo apt dist-upgrade -y
Remove dependencies from uninstalled applications:
sudo apt-get autoremove -y
Since we removed some kernels now and the initrd has been updated, it might be
a good idea to reboot again before next steps. Just to see if system is still ok:
Install the required packages to upgrade between Ubuntu releases:
sudo apt install update-manager-core -y
Run the Ubuntu upgrade manager utility and follow the instructions:
sudo do-release-upgrade -d
If anythong did go well you now should have a working Ubuntu 18.04 LTS installation, without a lot of reconfiguration and reinstallation. However it 'may' be necessary to touch up here and there after an inplace upgrade, since some things may have changed that cant be represented anymore under Ubuntu 18. Good Luck!
— Axel Werner 2018-06-18 08:50