How to create a local yum REPO from the RedHat install media

RHEL 7 local repo

cat > /etc/yum.repos.d/dvd-iso.repo << EOF
[InstallMedia]
name=RHEL-7.0 Server.x86_64
metadata_expire=-1
gpgcheck=0
cost=500
baseurl=file:///media/repo
EOF

mkdir /media/repo
mount /dev/sr0 /media/repo

RHEL 6 local repo

mkdir -p /mnt/DVD-ISO-REPO/
mount /dev/dvd /mnt/DVD-ISO-REPO/

copy the media.repo file from the ISO

cp /mnt/DVD-ISO-REPO/media.repo /etc/yum.repos.d/media.repo

echo "baseurl=file:///mnt/DVD-ISO-REPO/" >> /etc/yum.repos.d/media.repo

RHEL 5 local repo

cat > /etc/yum.repos.d/dvd-iso.repo << EOF
##repo file for mounting the RHEL 5.x DVD ISO


[local_Cluster]
name=Local Cluster
baseurl=file:///mnt/DVD-ISO-REPO/Cluster/
enabled=1
gpgcheck=0


[local_ClusterStorage]
name=Local Cluster Storage
baseurl=file:///mnt/DVD-ISO-REPO/ClusterStorage/
enabled=1
gpgcheck=0


[Local_Server]
name= Local Server
baseurl=file:///mnt/DVD-ISO-REPO/Server
enabled=1
gpgcheck=0

EOF

mkdir -p /mnt/DVD-ISO-REPO
mount /dev/dvd /mnt/DVD-ISO-REPO/
yum repolist

RHEL 4 local repo

Mount the RHEL 4 installation ISO.

mount -o loop,ro RHEL4.8-x86_64-AS-DVD.iso /media/cdrom
Comment out the following line in /etc/sysconfig/rhn/sources

This will prevent up2date from connecting to Red Hat Network

up2date default
Change to:
#up2date default
create a line like the following in /etc/sysconfig/rhn/sources
dir mydvdrepo /media/cdrom/RedHat/RPMS

List the REPOS

yum repolist

epel repo install

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm