Create YUM local-repo

Creating A Local Yum Repository (CentOS)

YUM Repositories are warehouses of Linux software (RPM package files). RPM package file is a Red Hat Package Manager file and enables quick and easy software installation on Red Hat/CentOS Linux.

YUM Repositories can hold RPM package files locally (local disk) or remotely (FTP, HTTP or HTTPS). YUM Configuration files hold the information required to successfully find and install software (RPM packages files) on our VM’s.

We can create a Custom YUM Repository from a desired number of selected RPM package files. Custom YUM Repository only holds the RPM package files we want to include in.

To create Custom YUM Repository we need to install additional software called “createrepo”.

We need to Copy or Move the rpm files to the repository directory.

Createrepo command reads through Custom YUM Repository directory and creates a new directory called “repodata” in it. Repodata directory holds the metadata information for the newly created repository.

Every time we add additional RPM package files to our Custom YUM Repository, we need to re-create Repository metadata with “createrepo –update” command. We can create new repository metadata by running the following command from console.

#cd /var/www/html/rhel7.1/Packages/

#createrepo –v .


To start using the newly created Custom YUM Repository, we must create the corresponding YUM Repository Configuration file with .repo extension, which must be placed to /etc/yum.repos.d/ directory.


name=Custom Repository


URL to the repodata directory. We can use




name=Custom Web Repository


0 – is for disable & 1 – for enable

#yum clean all

#yum repolist