Here is how to build a custom Yum Repository in FC3. This article builds on previous articles by Tony Smith and Hal Canary. The FC3 version of yum makes the previous instructions obsolete, however both articles are well worth the read if only to get an idea why creating your own yum repository might be desirable.
The version of yum shipped in FC3 is 2.1.11. This version requires XML Metadata for the package repository, rather than the text files of earlier versions of Fedora Core.
Previous Fedora versions would use the yum-arch tools to create the repository metadata (its usage is covered in the previous articles). If we run this tool on FC3 we get the following error
$ yum-arch
...
THIS PROGRAM IS DEPRECATED!
You should be generating xml metadata instead.
Please see http://linux.duke.edu/metadata
...
In FC3 we use the createrepo tool to create the XML metadata for the yum repository. Follow the steps below to install and use this tool.
1. See if the createrepo package is already installed
$ rpm -q createrepo
package createrepo is not installed
If the package has already been installed you'll get something like the following
$ rpm -q createrepo
createrepo-0.4.1-1
If the package is already installed skip the following step.
2. Install the createrepo package using yum (alternatively you'll find its rpm on FC3 disk 4)
$ sudo yum install createrepo
Follow the instructions. All that should be required is to press y when prompted.
3. Now we're ready to create the XML metadata
createrepo <path>
where <path> is the directory where your rpm collection exists.
If the command executes successfully the metadata files will be created in a directory called <path>/repodata
Yum can now be configured to use the new repository. Run as root to add repositories
$ vi /etc/yum.repos.d/sample.repo
Add the following lines
[sample]
name=My Sample Repo
baseurl=file://<path>/
enabled=1
where <path> is the same path used in step 3.
You could make your repository available to the world via HTTP by simply copying the rpm directory, including the repodata subdirectory, to your webserver.
Don't forget to run createrepo every time you make changes to your rpm collection to keep the metadata in sync.
Enjoy:-)