Howto Upgrade Ubuntu Server
Upgrading Ubuntu Server 12.04 LTS to Ubuntu Server 14.04 LTS
The process of upgrading Ubuntu Server 12.04 LTS to the latest 14.04 release can be carried out with one simple command. As always, when upgrading a server, make sure you have taken a backup of your data. It is always better to be safe than sorry!
The recommended way to upgrade your server is to use the command "do-release-upgrade":
This command will upgrade your operating system to the latest release. This is the preferred method where there is no graphical environment, or if the server is to be upgraded over a remote connection (ssh). I would always recommend not to upgrade a server over ssh, however, using this upgrade method does allow for this.
Before we start the upgrade process it is always useful to check which version of the operating system you are currently running and also what version of the kernel you have.
Checking Operating System and kernel versions
The commands to check your current version information are:
lsb_release -a - Displays current Operating System Version
john@ubuntu01-srv:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.04.4 LTS Release: 12.04 Codename: precise
uname -r - Displays current kernel version
john@ubuntu01-srv:~$ uname -r 3.11.0-15-generic
Initiating the Upgrade - do-release-upgrade
To initiate the upgrade, we must issue the "do-release-upgrade" command prefixed with "sudo":
You may also need to specify the -d option if no new release is found:
john@ubuntu01-srv:~$ sudo do-release-upgrade [sudo] password for john: Checking for a new Ubuntu release No new release found
Using the "-d" option:
john@ubuntu01-srv:~$ sudo do-release-upgrade -d Checking for a new Ubuntu release Get:1 Upgrade tool signature [198 B] Get:2 Upgrade tool [1,148 kB] Fetched 1,148 kB in 0s (0 B/s) authenticate 'trusty.tar.gz' against 'trusty.tar.gz.gpg' extracting 'trusty.tar.gz' Reading cache Checking package manager Continue running under SSH? This session appears to be running under SSH. It is not recommended to perform a upgrade over SSH currently because in case of failure it is harder to recover. If you continue, an additional SSH daemon will be started at port '1022'. Do you want to continue? Continue [yN] y
To continue with the installation you must reply "y" at the continue prompt. (see warning regarding SSH)
Starting additional sshd To make recovery in case of failure easier, an additional sshd will be started on port '1022'. If anything goes wrong with the running ssh you can still connect to the additional one. If you run a firewall, you may need to temporarily open this port. As this is potentially dangerous it's not done automatically. You can open the port with e.g.: 'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT' To continue please press [ENTER]
Next press [ENTER] to continue with the upgrade process.
After a short while you will see a screen similar to the one below "Configuring libc6 restart services (yes or no)":
During the course of the upgrade, various services will be stopped. These can be automatically restarted if you choose the "yes" option.
Removing obsolete Packages
Towards the end of the installation you will be prompted to remove any obsolete packages. Reply "y" to continue and remove. Details of these packages can be seen if you choose the "d" option:
Searching for obsolete software Reading package lists... Done Building dependency tree Reading state information... Done Building data structures... Done Building data structures... Done Remove obsolete packages? 13 packages are going to be removed. Continue [yN] Details [d]y
System Upgrade Complete
Congratulations, your server has now been upgraded to the latest release. However, before you can start using your server, a reboot is required. To finish the upgrade process and reboot, reply "y" to the prompt:
System upgrade is complete. Restart required To complete the upgrade, a system restart is required. If you select 'y' the system will be restarted. Continue [yN] The system is going down for reboot NOW!
Checking Operating System and kernel Version
Once your server has rebooted successfully we then need to check our versions. As we saw earlier, we can easily check our operating system and kernel version with the commands: "lsb_release -a and uname -r. It is always a good idea to check these after any upgrade process has been carried out:
john@ubuntu01-srv:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04 LTS Release: 14.04 Codename: trusty john@ubuntu01-srv:~$ uname -r 3.13.0-24-generic
You should now see the server has been upgraded to "Ubuntu 14.04 LTS" and is running with a newer kernel version.