Configure a local repository on Redhat Linux

Create a rhel package repository

Create a directory where packages will be stored:

# mkdir /repo

Two options: mount the distribution DVD or copy it into /repo.

To mount the DVD, edit the /etc/fstab file and add the following line:

/dev/cdrom /repo iso9660 loop 0 0

Then, mount the DVD:

# mount -a

To copy the DVD, type:

# mount -o loop /dev/cdrom /mnt

# cd /mnt

# rsync -arvh /mnt/* /repo

# cd /; umount /mnt

Optionally, update the repository structure (if new packages have been added):

# yum install -y createrepo

# createrepo /repo

Create the /etc/yum.repos.d/local.repo file and add the following lines:

[rhel-repo]

name=rhel-repo

Baseurl=file:///repo

enabled=1

yum repolist

Note: If you don’t remember the syntax, read the yum.conf man page.

Sources:RHEL 7 How t create repo,Fedora local dvd repo