Keeping your Linux system up to date with the latest security fixes and software updates can be a real pain. But it doesn't have to be.
Package management front-ends work a bit like Microsoft's Windows Update service. They access a repository of available software and synchronise the software on your computer with the latest versions available on the repository. Along with this update function, package management front-ends can also be used to install new software, and to remove software without breaking other applications.
YUM, or Yellow dog Updater Modified, is a package management tool for Red Hat Linux-derived distributions. What makes YUM special is its simplicity. As you'll see in this article, with the use of only a couple of commands it's easy to keep your system up to date with the latest fixes. I'll also show you how to build your own local repositories to save on network bandwidth if you're deploying updates to several Linux systems.
The YUM client and server are distributed together in a single package. YUM is already included in Fedora Core 2. I've included RPMs of YUM for each supported distribution on November 2004's cover CD. To install YUM, type the following command in a shell as root:
$ rpm -ivh yum-1.0.3.noarch.rpm
If you want to set up a YUM server, you'll need a Web server running: for example, Apache. Apache is included with most distributions and a copy has been included on November 2004's cover CD. After installing Apache, you'll need to allocate some disk space to your YUM package archive. On my system, I'm using YUM to maintain both Red Hat 9 and Fedora Core 2 systems. I've allocated 10GB of space on a partition mounted as /yumdata. After mounting the drive I made a symlink to my Web server's tree with the command:
$ ln -s /yumdata /var/www/html/
Now when I browse my Web server, my YUM repository will be available under http://webserver/yumdata
THE FEDORA LEGACY PROJECT
The Fedora Legacy Project (http://fedoralegacy.org) is a group of volunteers who, with the support of Red Hat, are prolonging the lifespan of many Red Hat-based Linux distributions. As each new version of Red Hat Linux & Fedora are released, older versions become unsupported. This means that security and bug fixes are no longer provided for these older distributions, effectively forcing anyone using the distribution into upgrading to a newer version. If you've got an older version of Linux working well, the Fedora Legacy Project might help you keep it running for a while longer yet.
Using the client
YUM gets its list of repositories from the file /etc/yum.conf. An example entry in this file is:
[base] name=base baseurl=http://webserver/yumdata/fedora/core/2/os
By default, this file will contain entries linking you to the update sites for your distribution.
The main activity you'll be using YUM for is updating your system. To perform an update, in a shell as root type the following command:
$ yum update
Depending on how out of date your system is, you may need to download anywhere from 100KB to several hundred megabytes. Installing packages is easy with YUM, as it handles all of the dependency resolutions. So, to install an add-on package such as MPlayer (see the sample yum.conf included on the cover CD for an available repository) which relies on several smaller packages, the following command can be used. Each package required by mplayer-gui will be installed automatically:
$ yum install mplayer-gui
The name of the package as specified in the RPM database is "mplayer-gui". To see a list of all the packages available in your YUM repositories, use the following command:
$ yum list
That's it, just three simple commands are all you need to use YUM effectively. It's a good idea to run regular updates. Get in the habit of running a YUM update every now and then. The more often you update, the less time each update will take.
APT: An Alternative System
APT is an alternative package management tool. Originally developed for the Debian Linux distribution (www.debian.org), it has since been ported to support RPM-based distributions as well. APT is a lot older than YUM, and supposedly more robust than its younger counterpart. However, I've never encountered problems with YUM in the time I've been using it. The Debian version of APT, APT-DEB is included in Debian by default. In fact, the entire distribution is built around the APT-DEB tool. APT-RPM, on the other hand, is available as a third-party add-on for most distributions from its homepage: https://moin.conectiva.com.br/AptRpm. I've included binaries of APT-RPM for many distributions on November 2004's cover CD.
So why use APT over YUM? The best argument is probably software availability. Many major third-party package Web sites such as http://freshrpms.net and the DAG RPM Repository (http://dag.wieers.com/home-made/apt/) are accessible via APT-RPM. Recently these sites have begun to add support for YUM as well, but APT is still more widely used, especially where less-mainstream RPM-based distributions are concerned.
Setting up an APT repository is similar to the process involved for building a YUM repository. You will need a working Web server and a fairly large area of disk space available to store RPMs. The command used by APT to build a repository is named "genbasedir" and is used in a similar way to yum-arch.
Of the two utilities, I prefer YUM. The differences are subtle, but YUM feels a bit lighter and ties in with Red Hat distributions tightly. If you're using another distribution however, APT is the only way to go: but there's no major downside to either option.
Building a YUM repository
The first repository you should build is a complete mirror of the RPMs for the distributions you'll be using YUM with. This comes in handy, mostly for resolving obscure dependencies for RPMs you'll be installing from other repositories. You never know when a package will rely on a set of fonts that isn't usually installed. To build this repository, simply copy the contents of the RPMS directory from each CD of your distribution to a directory on your hard disk, for example /yumdata/fedora/core/2/os.
Once you've collected all of the RPMs together, type the following command to build the repository:
$ yum-arch /var/html/www/yumdata/fedora/core/2/os
If you add RPMs to this directory later on, re-run this command to update the list of available packages.
Using the same method, you can now build other repositories containing extra software and distribution updates with the same command. A good idea would be to collect your favourite add-on software, for example MP3 plug-ins and media players such as MPlayer, into a directory for easy deployment to all of your systems.
Once your repositories are built, add entries to each client's /etc/yum.conf file and you're done.
|Distributions supported by YUM
Red Hat Linux 7.3-9.0
Fedora Core 1 & 2 Red Hat Enterprise Linux Mandrake Linux 9.2
Alastair Cousins is a System Administrator by trade and was first attracted to Linux in 1994 after discovering it was not only free, but included a port of DOOM. In his spare time he records music while keeping up an unhealthy dependency on coffee.