Posted by Steve on Fri 18 Feb 2005 at 23:40
Previously we've looked at setting up a virtual Woody installation, and now the real fun starts. Firstly we need to configure this virtual image to match our real one, then we can actually perform the upgrade.
In part one of this series we created a simple disk image with a minimal Woody installation on it. The intention wad that we could then use that image to mirror a real installation, and test a system upgrade upon it in a harmless manner.
To do this we need to do a few things:
The system that I'm looking at upgrading in this article is an internet server which handles email and website hosting for a number of domains.
The setup of both these components has been discussed in a reasonable amount of detail previously:
Whilst these services are not the most complex things you can use Debian for they are representative of a typical server, and nobody enjoys downtime when it comes to either website hosting or email handling.
When the upgrade to Sarge happens there are going to be two significant upgrades. In the time since Woody was released two years ago some of the major packages are now much improved by their authors.
Two of the more significant upgrades we're going to see are related to the software we wish to upgrade. Two major upgrades are now available:
Whilst we can continue to use the older versions of both of these packages we can gain a lot by upgrading both to the newer versions available, in the case of Apache we can gain the use of a lot of interesting new modules, and for Exim we gain a lot of increased flexability.
Mirroring your Live ServerUpgradingWhen it comes to mirroring your live machine (the machine whos upgrade we're looking at practising) we need to copy the packages and the configuration files.
On your live machine you can save the installed package list by running the following command:
dpkg --get-selections > package.listCopy the resulting "package.list" file to your Woody image and run the following command to duplicate those package installations:
dpkg --set-selections < package.list apt-get dselect-upgradeThis will download and install any packages required to match those on your live machine, however if debconf has been used to perform some configuration then that data will be lost - so you'll be prompted to answer those questions again.
To avoid this repetition you have two choices:
- Export the data from your debconf database on the live machine
- Ignore debconf completely and just copy the configuration files over once the packages have been installed.
To save time I went for the second option.
Because i'm only concerned about three services, ssh, exim, and apache it was simple to answer the questions with sane defaults then copy the following directories from my live machine over to my virtual image:
/etc/exim /etc/ssh /etc/apacheYou may have to handle this differently.
Testing the UpgradeTo perform the upgrade we need to adjust the source lists which apt uses to download its packages from.
Typically these will look like this:
deb http://http.us.debian.org/debian stable main contrib non-free deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-freeAt the point that Sarge is released "stable" will point to Sarge's packages on the Debian package sites. (This is something to be aware of if you have stable in your sources.list file right now and you perform automated upgrades via cron)
As Sarge isn't yet released we will need to name it explictly, by changing our sources.list to the following:
deb http://http.us.debian.org/debian sarge main contrib non-free deb http://non-us.debian.org/debian-non-US sarge/non-US main contrib non-freeThis points us explicitly at Sarge's packages. Once this is done you can begin the upgrade by running the following two commands:
apt-get update apt-get dist-upgradeThis is going to download a lot of packages to migrate from Woody to Sarge, in my test server it gave me the following output:
172 packages upgraded, 118 newly installed, 1 to remove and 0 not upgraded. Need to get 132MB of archives. After unpacking 172MB will be used. Do you want to continue? [Y/n]That's a lot of downloads! However for my installation this process was fairly painless. A few questions were asked which I merely answered with the defaults. This included things like:
- Whether to replace some bash initialisation files in /etc [Yes]
- Whether to restart services after upgrading libc [Yes]
- Whether to add new system accounts. [Yes]
After performing the upgrades and making sure things seemed mostly sane the first thing I did was to reboot my server.
This is an important thing to test, so better get it over and done with as soon as possible. Rebooting is something that I dont often recommend, short of upgrading a kernel, but in this case it allows us to test upgraded init scripts and that services continue to work with a new version of libc installed.
Once the machine has come back up we can then look at upgrading specific packages.
In the next article in this series we'll look at migrating from Apache to Apache2 and upgrading to Exim4.
If you do wish to test the upgrade yourself don't forget that my Woody image is available for download, as mentioned in part one.
This article can be found online at the Debian Administration website at the following bookmarkable URL:
This article is copyright 2005 Steve - please ask for permission to republish or translate.