Creating a Local Yum Repository

Create a Local Yum Repository

A very special thank you to David Cary Hart of TQMcube.com, who authored this tutorial for the benefit of the Fedora community.

If you have several computers to update via yum then you should consider creating a local repository. Not only does this conserve bandwidth (updates are downloaded only once) but it improves the responsiveness of yum for installing additional programs. Just about anything that you do with yum is considerably faster (LAN vs. WAN). The downside is that you will probably download updates that are unnecessary for any of your machines. You can reduce this with additional "exclude" statements like "--exclude=*i18*" (see man rsync).

Summary:

  1. Create the directory structure of the repository
  2. Copy the base RPMs
  3. Create the base repository headers
  4. Select an rsync mirror.
  5. Rsync the updates-released repository
  6. Edit yum.conf

Degree of Difficulty: Easy
Requires: Approximately 5 gb of Disk Space
Package: createrepo (su yum -y install createrepo)

1. Create the Directories:

mkdir /var/www/html/yum
mkdir /var/www/html/yum/base
mkdir /var/www/html/yum/updates

2. Copy the RPMs from the CDs/DVD to /var/www/html/yum/base

3. Create the base repository headers:

"createrepo /var/www/html/yum/base"

This might take some time, depending upon the speed of your processor(s) and HD. On successful conclusion, createrepo should create a directory /repodata. The contents should be:

filelists.xml.gz, other.xml.gz, primary.xml.gz, repomd.xml

4. Select a rsync mirror for updates:

A list is at http://fedora.redhat.com/download/mirrors.html and these are identified with rsync. For example: "rsync://distro.ibiblio.org/fedora-linux-core/". The mirrors share a common structure for updates. Simply append /updates/<d version>/<base arch>. Using FC4, this becomes:

rsync://distro.ibiblio.org/fedora-linux-core/updates/4/i386

5. Rsync to create the updates-released repository:

 "rsync -av rsync://distro.ibiblio.org/fedora-linux-core/updates/4/i386 -exclude=debug/ /var/www/html/yum/upates"

This will create a complete update repository at /var/www/html/yum/upates/i386. The repodata directory will be created with all of the headers. If you feel that you need the debuginfo rpms you can exclude the exclude statement. At this point you can create a cron job for the rsync command, above. Only new updates and headers will be downloaded to your repository. Optionally, one could add the "-H" flag to preserve hardlinks, and the "--delete" option to save space.

6. Edit /etc/yum.conf:

[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
#mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc$releasever
baseurl=http://192.168.0.xx/yum/updates/$basearch/
enabled=1
gpgcheck=1

[base]
name=Fedora Core $releasever - $basearch - Base

baseurl=http://192.168.0.xx/yum/Fedora/core/$releasever/base/RPMS
#mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-$releasever
enabled=1
gpgcheck=1

On the machine with the repository, substitute localhost for the IP address.

Thank you David!
This page was generously written and donated to the community by David Cary Hart.
* Minor Grammer Last Updated 2008-02-24 by Dotan Cohen
* HTML Last Updated 2008-02-24 by Dotan Cohen
* Implemented rsync suggestions by Erik Logtenberg on 2008-04-17



 


Fedora, yum, repository, Redhat, Linux yum, rpm management Fedora Core, Creating a Local Yum Repository Fedora, yum, repository, Redhat, Linux yum, rpm management
504znq@7963x1b.com t6k82@m0uo7rxo.com ctzgtm7e@glxem9hg.com 2ph0bi@0pnyela7.com r17yg1f@zto8b.com

eXTReMe Tracker