Fedora ships with two tools for installing packages using an internet connection: up2date and yum. With both you can easily get and install update packages which fix bugs or you can install additional packages you did not choose during initial installation of Fedora. This article will show you how to modify the configuration files of both tools to use a mirror server, while the default is to access the Redhat server which is often causing trouble and problems of different kind.
Maybe you already did use the unmodified setup of up2date or yum to
get the latest updates for
your Fedora Core system and may received error messages when running
the update tools: complaints
about corrupted GPG keys, CRC check errors indicating wrong file sizes,
cyrptic Python traceback
messages, or something else meaning that the update process failed. At
minimum the download is very slow.
This is especially the case when a new kernel came out.
The reason for all these problems and trouble is just the circumstance, that the tools up2date and yum are ready to work out-of-the-box by contacting the main Redhat server. Now when thousand of Fedora users are trying to get the new kernel and kernel source for instance, there is too much traffic this server has to manage. In result the communication between http://download.fedora.redhat.com and the update tools fails, showing up what I described.
The way out if this situation is very easy: just configure up2date or yum to use one of the official mirror servers. In the following I'll show you where and how you do this.
While for using the up2date tool on former Redhat releases you needed to subscribe the RHN, this tool now works on Fedora Core with free ressources. Even do not register with RHN. The configuration file for up2date is "/etc/sysconfig/rhn/sources". It is a plain text file and can be edited by an editor of your choice (i.e. vim, emacs, nano, joe, gedit, kedit). The following lines are already active (line with no leading #) in the file:
yum fedora-core-1 http://fedora.redhat.com/releases/fedora-core-1
yum updates-released http://fedora.redhat.com/updates/released/fedora-core-1
#yum updates-testing http://fedora.redhat.com/updates/testing/fedora-core-1
Put a # in front of each of the lines above. This marks them as comments.
Now visit http://fedora.redhat.com/download/mirrors.html and look there for a convenient server. A good choice is to select your country (if in the USA your coast) and then take one server address. The address of the server itself must be joined to the location of the Fedora files on it. A complete mirror of the Redhat master server contains the directories: 1, development, test, updates. Let us for this example configuration take the USA East Coast server http://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core. We take this URL and set up our first sources entry, the one for the Fedora core files. Enter this to "/etc/sysconfig/rhn/sources":
## Mirror USA East Coast distro.ibiblio.org
yum ibiblio-fedora-core-1 http://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/
The first line is just an identifying comment. The second line starts with the column indicating the source as a yum repository, the second column is a channel label of free choice and the third column is the repository address itself.
Be careful! The last line is not already correct, it is just the base. It is missing the rest of the path to the core directory. You can identify the final yum repository directory by looking for the "headers" directory. So the whole line must look like:
yum ibiblio-fedora-core-1 \
[ Be aware the the line above is just one single line with and I did put in the "\" only in to signify that I wrapped the line for visibility. ]
You may need to use a Web browser, starting at the location at the Fedora mirrors list, to find the appropriate directory on your mirror. Using this scheme it is easy to add the next two repository entries: one for the updates and one for the test packages. We first add the line for updates which are in "updates/1/i386/":
yum ibiblio-updates-released \
And finally we add the entry for the test packages, but we comment it, as we do not want it to be active and we do not want to download test packages.
# yum ibiblio-updates-testing \
We are now ready. Save the edited file and run up2date - either on command line or as GUI. It will now show you fetching the package list from the two active repositories. Done!
The tool yum (Yellowdog Updater Modified) is configured by "/etc/yum.conf" which by default also uses the Redhat server as source. So let us first comment out all entries with a "baseurl" URI by putting a # in front. Leave the first section [main] untouched. Now we add the source for the core packages, again using the ibiblio.org server (just as an example, please follow the advice given above for choosing an appropriate mirror).
name=Fedora Core $releasever - $basearch - Base
If you want to use a second source for the Fedora Core package, just add a second line or even a third below the "baseurl" beginning with http:// or ftp://. The variables "$releasever" and "$basearch" assure that future Fedora releases and architectures are to be found without the need for modifications of this configuration file.
The entry for the released Fedora updates then looks this:
name=Fedora Core $releasever - $basearch - Released Updates
That's all. Save the changed yum.conf file and run yum as before. You now see it fetching from the mirror.
Actually you have to modify by hand the configuration file of your tool of choice. But there are already hands on for having an ease of use setup tool doing this job in the future.
Not only the wise man knows that patience is the companion of wisdom. It is not the speed factor of old age. So when you see that there are new packages announced to be available for Fedora, please be a little patient and do not try to get the updates by running your tool every hour or even more frequent. Nor switch your sources back to use of the Redhat server. The bottleneck is this Redhat server, so give the mirror servers the change to connect the main server at full speed and redistribute the fetched packages around into the world.
A nice feature yum offers are automatic updates, running as a nightly, unattended background job. To enable this task run as root these two commands:
chkconfig --level 345 yum on service yum start
The yum update job is initiated by the daily cronjob. To adjust the run time see "/etc/cron.daily/yum".
While in this article I just described how to configure up2date and yum to use mirror servers as source for Fedora core package and released updates those two tools are more powerful. While this is not the topic of this howto you can add to the configuration files many more sources. Eric S. Raymond has written a howto for easy installation of multimedia packages which are not part of Fedora Core. And on the unofficial Fedora FAQ page you can find an advanced sample yum.conf file.CREDITS
This article is a revised version of a posting I mailed to
Fedora Project mailing list on Jan. 15th 2004 as a reaction on very
frequent questions about problems
users had using up2date or yum. The mail
is to be reached using the mailing list archive.
Many thanks goes to Stephen Walton for a close correction reading of my original mail. I too thank Colin Charles for inviting me to republish this little instructions paper here on fedoranews.org.