mkdir /etc/yum.repos.d/bak mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak mount -t iso9660 /dev/cdrom /mnt
cat >/etc/yum.repos.d/media.repo <<EOF [InstallMedia] name=Red Hat Enterprise Linux Server release 7 baseurl=file:///mnt gpgcheck=0 enabled=1 [InstallMedia_HighAvailability] name=Red Hat Enterprise Linux Server release 7 HighAvailability Add-On baseurl=file:///mnt/addons/HighAvailability gpgcheck=0 enabled=1 EOF
cat >/etc/yum.repos.d/dvd.repo <<EOF [RHEL5-Server-DVD] name=Red Hat Enterprise Linux 5 (DVD) baseurl=file:///mnt/rhiso/Server enabled=1 gpgcheck=0 EOF
yum makecache
Adding, Enabling, and Disabling a Yum Repository
yum-config-manager --add-repo repository_url
yum-config-manager --enable repository
yum-config-manager --disable repository
Creating a Yum Repository
To set up a yum repository:
Install the createrepo package:
yum install createrepo
Copy all packages for your new repository into one directory, such as /tmp/local_repo/:
cp /your/packages/*.rpm /tmp/local_repo/
To create the repository run:
createrepo /tmp/local_repo/
This creates the necessary metadata for the yum repository and places metadata in a newly created subdirectory repodata.
The repository is now ready to be consumed by yum. This repository can be shared over the HTTP or FTP protocol, or refered directly from the local machine.
NOTE: When constructing the URL for a repository, refer to the /mnt/local_repo not to /mnt/local_repo/repodata, as this directory contains only metadata. Actual yum packages are in /mnt/local_repo.