Creating your own YUM Repository
If you work with a sizable fedora deployment, building custom rpm packages and placing them in your own yum repository can make software deployment and maintenance easier to administer.
This process will not show you how to build your own RPM packages, though the Fedora Developers Guide has a some documentation on this in Chapter 4.
In this example I am placing Java packages built from the JPackage sources and the mplayer
codecs into a repository. Because of licensing restrictions these packages can not be distributed to the wider public, but I deploy them to all fedora desktop installs I manage, so having them in a repo on the intranet makes sense.
Building the Repo
Create a directory on you intranet web server, if you don’t have one you are going to need a web server or ftpd server setup to host your yum
repository. I chose the following directory structure:
repository name / distribution / version / arch
For my environment:
# mkdir -p /pub/scm/fedora/5/i386
Place all of your packages in this directory, and issue the following commands:
# cd /pub/scm/fedora/5/i386 # createrepo .
If this location is available to all of your machines via http or ftp, your repository is created. Just re-run the createrepo command whenever you make changes (add/remove/update packages) to your repository.
Client Setup
Your linux installs now need to know how to use this repository. To do this we need to add a repo file to each client. Add the file whatever.repo to /etc/yum.repos.d/.
Pasted below is the contents of my .repo file: (server name removed)
[scm] name=SCM for Fedora Core $releasever - $basearch - Base baseurl=http://servername/pub/scm/fedora/$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://servername/pub/scm/RPM-GPG-KEY-rgarth
The first line needs to be your unique ID for your repository. Use the ‘name’ field as a brief description of your repo. Baseurl is the most important field. I have used the variables, $releasever and $basearch, however you could hard code these to 5/i386 if you wished and if you wanted to use an i386 repo on an x86_64 box you would need to do this.
My packages have all been signed with my gpg key, if you have not done this, just set gpgcheck=0.
All done. When you next run ‘yum list’, all of your custom rpm packages should be displayed.
Posted in Uncategorized