About me
Services
Projects
Design Patterns
Archive
Contact
home > Archive > Updating multiple machines using yum.

Using yum to keep multiple machines up to date

The following short tutorial walks you through the steps required to configure yum to maintain more than one machine with the same packages, without having to manually update each machine using rpm or up2date.

Yum was configured on two Fedora Core 4 machines when writing this document.

What is yum?

Yellowdog Updater Modified or YUM is an automatic updater for rpm based linux systems. It computes package dependencies when installing new packages, downloading and installing those dependencies when required.

How does it work?

For starters you will need a Linux RPM based distribution installed on your hardware, and an installation of yum. I am using Fedora Core 4 and yum version 2.4.1-1.fc4. If you dont know where to get these, go to fedora.redhat.com to download Fedora. Once installed, you can continue with the next step, getting a package list.

Get a package list

From the command line there are a couple of ways you can get a list of available packages for update. The first is to use yum list updates. This will give you a list of packages that are available for update using yum. The yum list command has a number of options.

All the list [regexp] options mentioned above take file-glob-syntax wildcards or package names as arguments, for example yum list available foo* will list all available packages that match foo*.

The second way to get a list of packages available for update is to use yum check-update. This will display a list of packages available for update.

Install the available packages

Now that you have verified the list of available packages you can go ahead and update your system. Use yum update to update your system. By not providing a package name after this command, all available packages will be updated. If you only want to update the foo package, you can do this by using the command yum update foo Before installing the updates, yum will make sure that all of the prerequisites are installed as well.

Creating your own repository

Now that you have an idea how to use yum, we can go ahead and setup our own repository. Why do that? Imagine you have a cluster of 500 machines all running yum. Do you want all of them calling out to the yum repository to download their updates? A much better solution is to have one machine get the updates from a fedora mirror and distribute it amongst your cluster. That way you reduce the total bandwidth being used and you can control what packages are distributed to your cluster.

The package repository needs to provide files through apache. So you will need an apache web server. Create a folder on your webserver for providing yum content. This will be the URL of your yum repo.
e.g.: /var/www/html/yum-repo (http://yourserver/yum-repo)

Within the yum-repo folder we need to setup a a file structure for the base and update packages.
e.g.: /var/www/html/yum-repo/base and /var/www/html/yum-repo/updates

From your fedora install media, copy all of the rpm's into the base folder. If you didnt install the OS from disk, then copy all of the rpm's from the fedora site into your base folder.

Now that you have all of the rpm's on your drive, you will need to create the headers.
yum-arch /var/www/html/yum-repo/base

In addition to the base rpm's, you will need to keep up to date on the available rpm packages. You can do this by rsync'ing with a repository that allows rsync and downloading the packages to the updates folder. You can see a list of available mirrors at fedora.redhat.com/download/mirrors.html Your rsync command should look something like this, rsync -avrt rsync://mirrors.kernel.org/fedora/core/updates/4/i386/ var/www/html/yum-repo/updates This will create the update portion of the repository for you. Create a cron job that will run the rsync command this will ensure that your repository always has the most recent packages.

Modify your yum.conf file to point to your repository as the location for yum updates.
e.g. baseurl=http://localhost/yum-repo/updates

Update the yum.conf file in all of the machines in your cluster and they will be updated with the same version of packages rsync'd to your repository.

Good luck!
Copyright 2008 Graham Lange All rights reserved
SUBSCRIBE