3. Upgrading Using Yum

Having set up a yum repository, can you then use it to perform an upgrade, say from beta 2 to beta 3? Based on one experiment, the answer is a qualified yes. Be prepared to throw away several MB of header data as you complete the process below.

This process has been experimentally verified by upgrading from Fedora Core 0.94 (beta 2) to Fedora Core 0.95 (beta 3). It does not work when upgrading from Red Hat 8 to Fedora Core 1. Your mileage may vary.

3.1. Server

On the server, set up your repository for the new version as above. It is probably a good idea to set the new one up in parallel with the old one, so that you have the directory 0.95 in /var/ftp/pub/yum-repository/redhat/ as well as 0.94.

3.2. Client

3.2.1. Back It Up

Unless the client is a sacrificial machine, Back It Up. Completely. Down to bare metal restore capabilities. See the Linux Complete Backup and Recovery HOWTO at the usual Linux Documentation Project places.

3.2.2. Clean Out Old Headers

You are about to change out your update repository. The first thing to do is clean out your headers and packages. This will help avoid confusion later on. To get absolutely everything:

rm -r /var/cache/yum/*

3.2.3. The Update Repository

Edit /etc/yum.conf's [updates] section to point to the new version. By the way, it is not in the man page for yum.conf, but it appears yum accepts the sharp character (♯) as a comment character. This is handy for temporary hacks like this.

If all you did on the server was to put the new version where the old one used to be, then change the version number from the macro to the absolute version number, like so:

[updates]
gpgcheck=1
name=Red Hat Linux $releasever - Updates
baseurl=ftp://yumserver/pub/yum-repository/redhat/0.95/$basearch/
# baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/updates/$releasever/

Temporarily, comment out your base repository and any others you may have.

3.2.4. Get New Headers

Now, get all new headers for the update repository by running the command:

yum check-update

You should see a series of new headers pulled in for the update repository. You should see something like:

XFree86                             i386   4.3.0-37                 updates
XFree86-75dpi-fonts                 i386   4.3.0-37                 updates
XFree86-Mesa-libGL                  i386   4.3.0-37                 updates
XFree86-Mesa-libGLU                 i386   4.3.0-37                 updates
XFree86-base-fonts                  i386   4.3.0-37                 updates
yada, yada, yada...

3.2.5. Kernel Upgrade

I don't know if it is strictly necessary to upgrade the kernel separately, but that's what I did. A quick check ("yum check-update | grep -i kernel") tells me that there is a kernel upgrade between .94 and .95. So the first thing I did was:

yum upgrade kernel

That worked just fine.

3.2.6. Everything Else

After that, I ungraded the rest all in one swell foop.

yum upgrade

I used upgrade instead of update because it will handle package obsolescence. However, the yum man page is clear that upgrade is deprecated and will eventually be removed.

3.2.7. Editing Yum.conf Again

/etc/redhat-release is now a symlink to /etc/fedora-release. On the off chance that the former will eventually go away (the package did), you might edit [main] in yum.conf to include "distroverpkg=/etc/fedora-release". Another that went away is redhat-logos.

Now edit your yum.conf [updates] section to reflect possible changes in your repository locations. The $releasever and $basearch macros should handle the problem, but paranoids live longer: check what you do carefully. You should be able to do this by commenting out the baseurl line with the hard coded version number, and commenting back in the version with the $releasever macro.

Since I don't maintain a local updates repository, this works for me:

[updates]
gpgcheck=1
name=Red Hat Linux $releasever - Updates
# baseurl=ftp://yumserver/pub/yum-repository/redhat/0.95/$basearch/
baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/updates/$releasever/

3.2.8. Clean Out Old Headers, Again.

Once more, with feeling: clean out your headers and packages. To get absolutely everything:

rm -r /var/cache/yum/*

3.2.9. The Smoke Test

Reboot and try it.