Login Register

HOWTO: Create your own YUM repository on Redhat and Fedora Linux

If you have software packages which you wish to share with others or simply between your own personal machines, a neat and easy solution is to create your own YUM repository and provide your .repo file for download.

YUM is by far the easiest method of installing software on Red hat, Centos and Fedora. Not only does it mean you don't need to trawl the web looking for somewhere to download the packages, YUM does a great job of satisfying any package dependencies. As long as the required packages are available in the enabled repositories on your system, YUM will go out and get everything you need.

To create your own YUM repository, you will need to install the yum-utils and createrepo packages:

yum install yum-utils createrepo

yum-utils contains the tools you will need to manage your soon to be created repository, and createrepo is used to create the xml based rpm metadata you will require for your repository.

Once you have installed these required tools, create a directory in your chosen web server's document root e.g:

mkdir -p /var/www/html/repo/recital/updates

Copy the rpm's you wish to host into this newly created directory.

The next step is to create the xml based rpm metadata. To create this use the createrepo program we installed earlier.

At the shell type the following command:

createrepo -v -s md5 /var/www/html/repo/recital/updates

This will create the required metadata in the repodata directory of your /var/www/html/repo/recital/updates directory.

root@test repodata]# ls -l
rwotal 44
-rw-r--r-- 1 root root 28996 Jan 13 21:42 filelists.xml.gz
-rw-r--r-- 1 root root   284 Jan 13 21:42 other.xml.gz
-rw-r--r-- 1 root root  1082 Jan 13 21:42 primary.xml.gz
-rw-r--r-- 1 root root   951 Jan 13 21:42 repomd.xml

To do a final consistency check on your repository run the following command:

verifytree /var/www/html/repo/recital/updates

We now have a fully functioning YUM repository for our hosted rpm packages.
The next process is to create a .repo file in the client systems /etc/yum.repos.d directory.

Navigate to the /etc/yum.repos.d directory on your system as root.

Using your preferred text editor to create the .repo file. In this example I will call it recital.repo.
Now paste in the following lines:

name=Recital Update Server

Once that is saved, at the shell prompt on the same machine (YUM client system).

$ yum repolist
Loaded plugins: presto, refresh-packagekit
repo id                  repo name                                 status
Recital                  Recital Update Server                     enabled:      1
adobe-linux-i386         Adobe Systems Incorporated                enabled:     17
fedora                   Fedora 12 - i386                          enabled: 15,366

As you can see the Recital repo is now being picked up and we have access to all the packages it is hosting.

See how easy that was!


Copyright © 2021 Recital Software Inc.



User Registration
or Cancel