Upgrading Ubuntu 12.04 Precise to 14.04 Trusty

Posted 2014-03-20 15:10 by andreychek

This document will guide you through upgrading an Ubuntu 12.04 (Precise) server to an Ubuntu 14.04 (Trusty) server.

We highly recommend that you perform all of these steps on a test system before making changes to your production server -- that way, you can minimize downtime by knowing what to expect.

You should plan for some downtime -- there are big differences between the two distributions, and things don't always go as smoothly as we would hope.

Note that Ubuntu recommends waiting for the first dot release before performing an upgrade:

"Upgrades between LTS releases are not enabled by default until the first point release, 14.04.1, scheduled for July. It is recommended that most LTS users wait until then before upgrading to 14.04."

You can see the full release notes here (we'd recommend reading these before performing an upgrade):

https://wiki.ubuntu.com/TrustyTahr/ReleaseNotes

Also, Ubuntu 14.04 comes with PHP 5.5.9. Verify that your PHP applications support that PHP version.

For those wishing to upgrade, the following steps will guide you through the process --

Upgrade Guide

Backups

Make sure you have full backups of everything on your server that is important to you. At the very least, you should generate full backups of all your Virtual Servers. You may also want to make a backup of everything in /etc.

Package Updates

Make sure your system is fully up to date by running these commands:

sudo apt-get update
sudo apt-get upgrade

Reset Dependency Flags

These packages are already installed, but the following command will tell apt not include them anytime "apt-get autoremove" is run:

apt-get install bind9 spamassassin spamc procmail libnet-ssleay-perl libpg-perl libdbd-pg-perl libdbd-mysql-perl quota iptables openssl python mailman subversion ruby irb rdoc ri mysql-server mysql-client mysql-common postgresql postgresql-client awstats webalizer dovecot-common dovecot-imapd dovecot-pop3d proftpd webmin usermin webmin-virtual-server libcrypt-ssleay-perl webmin-virtual-server-theme webmin-virtualmin-dav webmin-virtualmin-svn webmin-virtualmin-awstats webmin-virtualmin-mailman webmin-virtualmin-htpasswd clamav-base clamav-daemon clamav clamav-data clamav-freshclam clamav-docs clamav-testfiles libapache2-mod-fcgid scponly apache2 apache2-doc libapache2-svn libsasl2-2 libsasl2-modules sasl2-bin usermin-virtual-server-theme procmail-wrapper php-pear php5 php5-cgi webmin-security-updates

Update Manager

Make sure you have the update manager core by running this command:

sudo apt-get install update-manager-core

Begin Upgrade

Run the following command to begin the upgrade process. Ubuntu suggests running this from the console, though it should also work from SSH:

do-release-upgrade -d

And then follow the on-screen instructions.

In general, if you are prompted about whether to replace a config file with a new one, or keep your existing one -- we would suggest keeping your existing config.

Coffee

Now is an excellent time to go get some coffee or another beverage of choice, while the packages are downloaded and installed :-)

Reboot

When the upgrade completes, it will prompt you to reboot your system. Perform the reboot, and when your system comes back online, there's just a few more things to change.

Change apt config

Edit /etc/apt/sources.list, and uncomment the Virtualmin repositories. Then change any references of "precise" in those repositories to "trusty".

Run this command, and make sure the new apt config works properly:

apt-get update

Apache Config

There were some significant changes made to Apache. You'll need to make the following updates to /etc/apache2/apache2.conf:

Comment out the following lines that appear in the apache2.conf:

Include httpd.conf
Include conf.d
LockFile ${APACHE_LOCK_DIR}/accept.lock

Re-enable Apache modules:

a2enmod suexec
a2enmod actions

Now enable some Apache modules:

a2enmod suexec
a2enmod rewrite

Then restart Apache:

service apache2 restart

Verify DNS Config

Edit /etc/resolv.conf, and verify that the nameserver line is configured to use 127.0.0.1 as a nameserver.

Test

That's it for configuring your updated system. Now it's time to test your services and websites!