Create yum repository in Redhat Linux

Yum is the package manager that is used in Redhat , Yum searches numerous repositories for packages and their dependencies so they may be installed together in an effort to alleviate dependency issues. Red Hat Enterprise Linux 5 and Red Hat Enterprise Linux 6 uses Yum to fetch packages and install RPMs. We can use our installation media for creating yum repository. Below steps will explain to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 6.

Create a folder and mount RHEL 6 iso image to that folder.

# mount -o loop /vmstorage/rhel6.iso /repo/

Note: If we are directly using DVD Media, we can mount it without loop option.

# mount /dev/cdrom /repo/

Copy the repo file from the root of the mounted ISO to /etc/yum.repos.d/ and set the appropriate permission.

Edit the new repo file. Change the gpgcheck=0 setting to 1 and add the following 3 lines (make sure to replace “Server” with “Client” or “Workstation”, depending on the type of RHEL DVD version in use):

enabled=1

baseurl=file:///repo/Server

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

After completing editiong , the new repo file could look like the following (the mediaid will be different depending on the version of RHEL):

We can run the the command ‘yum clean all’ once to clean up repository erros. . Also note that if the system is registered to Red Hat Network, yum can be run with the –noplugins option to prevent it from connecting to RHN.

# yum clean all

Loaded plugins: refresh-packagekit, rhnplugin

Cleaning up Everything

# yum clean all --noplugins

Cleaning up Everything

Note:

We can also configure repositories for addition addons like High Availability, LoadBalancer, ResilientStorage, and ScalableFileSystem. By editing the file as below.