Web Projects Outsourcing

Local Yum Rpm Repository

YUM is the default package manager provided with most RPM distros, especially Fedora and Redhat based distros. It is similar to APT of the Debian based distros. Admittedly, it is not the best package manager in term of performance, I personally feels APT is faster and easier to use. However, it do have some good points. One of it is the ease of creating a YUM RPM repositories.

Some users might want to store cached/downloaded RPM packages for backup or future offline use. Some of them might also want to easily resolve dependencies of downloaded RPMs from non-repository sources. By having their own repository, they can easily install the RPMs and avoid dependency hell.

To create our own repo, we use a tool called “createrepo”. Its available in the Fedora DVD/CD and you just need to insert the DVD/CD and install it. You can also get it through yum.

yum install createrepo

After you’ve installed createrepo, dump all of the RPMs you want to create a repo with inside a directory. For the sake of this howto, lets say the directory is ‘/mnt/storage/myrepo/’.

Then, run createrepo in the directory. More options of createrepo can be found in its manpage.

cd /mnt/storage/myrepo/
createrepo .

After createrepo finished generating the metadata, your repository is ready for use.

To use the repo, you’ll need to create a yum configuration for it in /etc/yum.repos.d/. Below is an example of a basic yum configuration.

File /etc/yum.repos.d/myrepo.repo:

[myrepo]
name=My Personal Yum Repo
baseurl=file:///mnt/storage/myrepo/
enabled=0

I purposely set “enabled = 0” so that yum won’t automatically use the repo by default. This is to avoid conflict between packages from the official repos and your repo. You can explicitly tell yum to use it by using the “–enablerepo=” option.

yum --enablerepo=myrepo install PACKAGENAME

To those who prefer to use APT, the latest APT-RPM tool can use Yum repositories as its repo. Thus making the usage of APT easier on YUM distros.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.