Upgrading Ubuntu Server 13.04

I ran into a circular issue – I needed a git feature, subtree, but the version of git I had didn’t have that feature.  In trying to update git with apt-get, I found that the packages on Ubuntu Server 13.04 aren’t kept up to date anymore.

I did edit the sources list that fixes the issue of seeing 404 Not Found when doing apt-get update.  This command may be all you need to if you’re seeing that error – at least it’s worth a try before anything else.

nano /etc/apt/sources.list

You should see 4 lines.  Replace where it says either archive or security with old-releases.  Example:

deb http://old-releases.ubuntu.com/ubuntu trusty main restricted universe

Now try apt-get update.  If that doesn’t fix your problem – and it didn’t fix mine in terms of updating git, you can upgrade the Ubuntu Server release, to 14.04LTS, for example.  LTS stands for Long Term Support.  Try running do-release-upgrade.  If it says command not found, you’ll first have to install aptitude to install the update-manager, then run do-release-upgrade.

apt-get install aptitude
aptitude install update-manager update-manager-core

Then you can run do-release-upgrade.  Before you go through with the upgrade, be sure to BACK UP EVERYTHING.  Files, database, etc.  What I did was zip my /usr/share/nginx/html and /etc/nginx/sites-available directories and saved the zips and I backed up my databases in case the server crashes.

When you’re ready, run do-release-upgrade.  It asks you a bunch of questions through the whole install, so you’ll kind of have to be around.  It does take a lot of server resources, so your server, websites, databases will run slower while it’s preparing.  Hopefully nothing goes wrong, in about 30-45 minutes you’ll have the upgraded version of Ubuntu!  Your websites shouldn’t be down for that long.  The whole process took me about 30 minutes and my sites were down for maybe 15.  After restarting to finish the install, I had Ubuntu Server 14.04.2LTS and git was updated in the process, so I have the git subtree feature I was initially looking for.

Wow that was a lot of work for a simple update!  Anyway, there could be some tips in here to save you time!