This is more to aid my memory than anything else, as it is something we do for the 300+ servers on a regular basis that I help to host.
sudo apt-get update sudo apt-get upgrade sudo apt dist-upgrade sudo apt-get autoremove sudo apt install update-manager-core sudo do-release-upgrade
Once upgrading to Ubuntu 18 it is good to note that Apache and PHP will stop working. The fix for this is to re-install the php and libapache2 php mod after the upgrade
sudo apt install php sudo apt install libapache2-mod-php