May 28, 2009

Fixing yum for older Fedora installations

On an old Fedora system (say Core 5 or 6), you may encounter this problem:

# yum list kernel
Setting up repositories
Error: Cannot find a valid baseurl for repo: core

For releases that have reached EOL (end of life), this happens because their repositories are no longer available on the Fedora Public Active Mirrors system.

They are, however, still available in the archives. The solution is to update the yum repository configuration to use the archives instead of the now nonfunctional mirrorlist.

# cd /etc/yum.repos.d/
# ls
fedora-core.repo fedora-updates.repo fedora-extras.repo

There may be more files there, but those are the ones you need to change. Edit each of the above files and go to the first section, called [core], [updates] and [extras], respectively. You don't need to bother with the other sections, as they have "enabled=0" so they are not normally used. Comment out mirrorlist (and existing baseurl, if not already done) and add a new baseurl line, as shown below (the additions are shown in darker color):

fedora-core.repo
[core]
name=Fedora Core $releasever - $basearch
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/
#mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-$releasever
baseurl=http://archives.fedoraproject.org/pub/archive/fedora/linux/core/$releasever/$basearch/os

fedora-updates.repo
[updates]
name=Fedora Core $releasever - $basearch - Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
#mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc$releasever
baseurl=http://archives.fedoraproject.org/pub/archive/fedora/linux/core/updates/$releasever/$basearch/

fedora-extras.repo
[extras]
name=Fedora Extras $releasever - $basearch
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/
#mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-extras-$releasever
baseurl=http://archives.fedoraproject.org/pub/archive/fedora/linux/extras/$releasever/$basearch/


You may need to run "yum clean all" afterwards to remove the old data from the yum cache.