How to Create Local Yum Repository

If you have installed Linux (CentOS, Fedora etc.) on your System which doesn’t have internet connections in that case it’s very difficult to install packages i.e. everytime you will have to insert OS DVD and need to install packages or even if you copy all the RPMS to local system you will have to face the dependencies problems. To fix this problem, we can create a local reposiorty of the RPMS which we have copied into the Local System. following are the steps to create a local repository

1) Copy all the RPMS from the DVD to a particular folder lets say /root/os/RPMS

2) Install createrepo RPM from /root/os/RPMS directory using rpm command

3) Now, we will have to create repo of the directory in which we have coied the RPMS. Following is the command to create the repo

[root@server ~] createrepo /root/os/RPMS

Once the above command gets completed you will find repodata directory in /root/os/RPMS folder

4) configuing YUM to work with local repository. Create a new file in /etc/yum.repo.d/ or open /etc/yum.conf and paste following

[local repo]
name = OS $release - MyLocalRepo
baseurl = file:///root/os/RPMS/

Now Try to install any package using YUM

About: Mike

Milind Koyande loves to work on new technologies specially virtualization and troubleshoot server problems. I’m an avid photographer and love to spend my free time close to nature, trying to capture its glory on my camera.

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