Linux Configuring YUM Custom Repository

Large Companies have some critical servers that contain sensitive information about the organization and sometimes very sensitive customer information as well. These companies won’t allow internet access to those critical servers and try to make them as secure as possible. Think about an organization running multiple RED HAT Linux Servers and won’t allow internet access to them, how they can achieve full proof security and have their systems up to date?

RHEL 5x and 6x RED HAT introduces an open source package manager called YUM, which automates the installation, management and removal of software packages. YUM computes dependencies for RPM and takes any actions required to successfully install software packages. As YUM automatically locates and obtains the correct RPM packages from repositories, the user doesn’t have to manually find and install new applications or updates.

You can also setup your custom repository for the RHEL machines. YUM repositories can hold RPM package files locally (local disk) or remotely (FTP, HTTP or HTTPS). Let’s check how custom repository for YUM can be setup.

Following are the few steps that can help you configure YUM repository:

1.  Mount Package.ISO file

Mount the Package file in the directory (most of the people mount it in media directory). The command that use to mount your DVD is given below:

#mount -o loop disk.ISO  /path to mount directory

2.  Move to package directory

#cd /media/mount/RHEL DVD/Packages

3. Intall Pre-req Packages

You’ve to install createrepo.rpm Package but first you do have to install Dependencies that are needed by createrepo.rpm

# rpm -ivh vsftpd*

#rpm -ivh deltarpm*

#rpm -ivh python-deltarpm*

Now install createrepo.rpm

# rpm -ivh create repo


4. Create folder for repository

Now move to the root directory and create folder to copy the Packages say “repository”

#mkdir /root/repository

5. Copy Packages folder and GPG KEY

Move to the media folder and type the below command to copy Packages folder and GPG KEY

#cp -rvf /files to copy /path to paste

#cp -rvf Packages / RPM-GPG-KEY-redhat-release /root/repository

6. Make Database entry

Once files are copied, use the following command to make database entry(this might take some time).

#createrepo –database /root/repository/Packages

7. Create .repo file

Now we have to create the .repo file and set some parameters

#vi /etc/yum.repos.d/<name of file.repo> say custom.repo

Put the following lines


name = Local Repository ( you can give any name)

baseurl= <path to directory of packages> say file:///root/repository/Packages (this is the path where you packages are located).

(to access repo on ftp, just use fttp://)

enabled=1 (This is use to enable or disable this repository. 1 =enable is for enabling it and put enable=0 if you wish to disable it).

gpgcheck=1 (This verify the authenticity of the packages by checking the GPG signatures. set to 0 if you don’t wish to use GPG check or if you have unsigned packages).

gpgkeyfile=file:///repository/ RPM-GPG-KEY-redhat-release /root/repository (Pathname of the GPG public key file that you’ve copied.)

:wq (save the file).

To check the configuration type the following

#yum repolist

It will return the list of available repositories.


  • By using the custom repository, you don’t actually have to go to the internet for fetching the packages.
  • Critical servers can also be able to have latest releases.
  • 1 repo = can serve all servers of the same architecture.
  • Reduce Bandwidth.
Previous Post Next Post

You Might Also Like

No Comments

Leave a Reply