How to Create Repository in Linux Environment

Posted By: Poketors - March 23, 2012
It is a very known fact that we can install packages in Linux by using RPM (Red Hat Package Management). Along with all the advantages using RPM, there is one big disadvantage by using RPM that we can’t install packages which depend on other packages i.e dependencies. so in order to install packages which depend on other packages, we have to install packages by using YUM (Yellowdog Updater Modified). Actually YUM is added from RHEL5 onwards. YUM uses a repository for installation. YUM automatically computes dependencies and figure out what things should occur to install packages. YUM can install, remove upgrade or query the packages efficiently.

How to Create Repository in Linux Environment

Now we can go ahead to create repository. Please follow these tips to add a local repository in your hard drive, here I am showing how to create repository in RHEL6.

Step 1: Create any folder i.e Directory
# mkdir /var/ftp/pub

Step 2: Move all RHEL DVD files to this directory /var/ftp/pub

# cd /var/ftp/pub

Step 3: Append the file localRepo:

# cd /etc/yum.repos.d

# vi localRepo.repo


:wq! (Save and Quit)

Step 4: Create repository

#cd /var/ftp/pub/Packages
#rpm -ivh createrepo* --force

#createrepo -g /var/ftp/pub/repodata/repomd.xml /var/ftp/pub/Packages

Step 5: Run following command

# yum clean all
To checkout list of installed packages use following command:

# yum list installed

Now the repository has been created in your system.

Copyright © 2010-2021 Poketors | The content of this website is copyrighted and may not be reproduced on other websites.| Email us at :