Powered by Drupal

Setup A Local Fedora 12 Yum Repository

The following will explain how to setup a local Fedora 12 yum repository. This example shows how to setup a local copy of the the "fedora-updates" repo. The same method can be used to also make a local "fedora" repo.

First install and setup Apache with the following:

yum install httpd
chkconfig httpd on
service httpd start

Now create the updates directory.

mkdir -p /var/www/html/yum/updates/12/i386

Next you need to find a yum repository that offers rsync to mirror. Do this by first going to http://mirrors.fedoraproject.org/mirrorlists/publiclist/Fedora/12/ and looking for a fast mirror in your country that lists rsync as a content type. In my example I used mirrors.kernel.org. Now sync the repo to your new directory:

rsync -avrt --delete rsync://mirrors.kernel.org/fedora/updates/12/i386/ --exclude=debug/ /var/www/html/yum/updates/12/i386/

Now to keep it synced you can setup a crontab to run the above command every day or two. The example below is setup to sync nightly at 2:00am:

crontab -e
0 2 * * *	rsync -avrt rsync://mirrors.kernel.org/fedora/updates/12/i386/ --exclude=debug/ /var/www/html/yum/updates/12/i386/

Now you just need to setup your machines to use the new repository. To do this log into each machine that will be using the new repo and create a new repo file:

vi /etc/yum.repos.d/local-update.repo

Now add the following to the file. Replace the with your local ip of the machine you created the repo on. If you are creating the repo file on the same machine the repo is on then you can replace it with the loopback ip,

name=Fedora $releasever - $basearch - Updates

Now comment out the fedora repo that you replaced. Since this example replaced the fedora-updates repo then do the following to disable it:

vi /etc/yum.repos.d/fedora-updates.repo

Under the [updates] heading look for the enabled=1 line and change it to enabled=0.

You should now be using your local copy of the fedora-updates repo instead of one of the remote mirrors.