
So I finally decided that my Ubuntu server needed a little updating yesterday. Although I do perform regular security updates and other configuration changes, this just so happened to be the first time I’d done a full distribution upgrade on an Ubuntu box. This was mainly performed out of curiosity and not of out of need. Surprisingly enough, it was very easy and required little interaction on my part. Here are some of the easy steps if you want to update your Ubuntu server to the latest distribution (currently Ubuntu 8.04 LTS HardyHeron).
Note: It is highly advised that you back up any critical data or system files prior to performing this how-to on your server.
1.) Make a backup of your /etc/apt/sources.list file
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.) Open the sources file for editing
sudo vi /etc/apt/sources.list
3.) Change the distribution references to the next logical upgrade, but only one at a time. You will need to complete all the steps in this how to for each logical step (dapper->feisty->gutsy->hardy) it will take you to get to the latest version. Use the following VI command (:%s/olddist/newdist/g) to change all the references in the sources.list file. For my first upgrade from dapper to feisty I used the following…
4.) Update the newly reference package list…
5.) Upgrade to the next distribution. If it asks to replace the config file for say Apache or PHP I would recommend leaving it the same (option “N”). I have a few virtual hosts setup and the default site with Apache and some custom stuff in my PHP.ini and the production setup was unaffected by leaving the configs the same throughout the upgrades.
sudo apt-get dist-upgrade
6.) Make sure everything ran ok. I ended up having to catch a plane while I was running the distribution upgrade in the airport and my SSH session terminated unexpectedly, which I thought was going to mess everything up. I ended up coming back today and running the second command listed below and it picked right up where it left off.
sudo apt-get -f install
sudo dpkg –configure -a
7.) Reboot your system…
8.) After it boots back up check your distribution…
9.) Rinse and repeat and make sure to make the necessary mods in step 3 to upgrade to the next logical distro until you’re running the latest version. Special thanks to rob-the.geek.nz and debainadmin.com for creating the original material I used to help perform my upgrade. I just added some of my personal tid-bits to this document and made it my own reference for later.
PS - This is my first time using code-snippet and I love it. Props to hackerforhire.org for reviving such a useful tool!
***Update (9/19/08)***
I’ve performed this process on three other systems that I manage and they all worked flawlessly from dapper to feisty to gutsy to hardy. I’ve also received some feedback from some in-tar-web friends that have also successfully used this how-to to upgrade their systems too. W00t!
***Update (9/25/08)***
I noticed that my servers were acting a little sluggish so I jumped on the console and found a ton of device mapper errors. I thought it was going to be a big pain trying to resolve the issue, but apparently evms was installed during the upgrade process and has a known bug. I ended up finding an article that suggested removing evms. I used the following command followed by a reboot to resolve the issue.