Howto: create a local repository for Fedora.

Creating a local Fedora repository is a great way to conserve bandwidth. You can update all of the computers on your local network from one repository.

1)  Install a web server.  I use apache.
su -c yum install httpd -y

2)  Create the directories that become the local repository.
su -c mkdir -p /var/www/html/yum/F15/releases
su -c mkdir -p /var/www/html/yum/F15/updates

3) Install the remote synchronization tool rsync.
su -c yum install rsync -y

4) Use rsync to populate your repository.
/usr/bin/rsync -avrt rsync://linux.mirrors.es.net/fedora/linux/updates/15/x86_64/ –exclude=debug/ /var/www/html/yum/F15/updates
/usr/bin/rsync -avrt rsync://linux.mirrors.es.net/fedora/linux/releases/15/Everything/x86_64/os/Packages/ /var/www/html/yum/F15/everything

I create a cron job for the rsync process. The following synchronizes daily.
su -c touch /etc/cron.daily/rsyncfedora15.cron
su – gedit /etc/cron.daily/rsyncfedora15.cron

Paste the 3 lines of code below into the rsyncfedora15.cron file.
#!/bin/bash
/usr/bin/rsync -avrt rsync://linux.mirrors.es.net/fedora/linux/updates/15/x86_64/ --exclude=debug/ /var/www/html/yum/F15/updates >> /var/log/rsync15updates.log
/usr/bin/rsync -avrt rsync://linux.mirrors.es.net/fedora/linux/releases/15/Everything/x86_64/os/Packages/ /var/www/html/yum/F15/everything >> /var/log/rsync15.log

Then save the file.
This also creates and appends two log files rsync15update.log and rsync15.log in the /var/log directory.

The first time the repository synchronizes it may take considerable time and bandwidth.  Be patient for the process to complete.

If you do NOT plan to make a full mirror of an existing Fedora repository you should use the createrepo tool to create and populate the data files and directories correctly.
su -c yum install createrepo

Then
su
createrepo -v -p -d –deltas /var/www/html/yum/F15/everything

Now you have created the repository for Fedora 15.

Next I create files in my  /etc/yum.repos.d/  called local.repo and localupdates.repo

local.repo has the following in it:

[local]
name=Fedora $releasever – $basearch
failovermethod=priority
baseurl=http://192.168.1.100/yum/F15/everything/i686/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

localupdates.repo:

[local-updates]
name=Fedora $releasever – $basearch – Updates
failovermethod=priority
baseurl=http://192.168.1.100/yum/F14/updates/i686/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

Then I copy those two files to all of my systems.