Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 6
Environment
- Red Hat Enterprise Linux 6
Issue
- How to set up yum repository to use locally-mounted DVD with Red Hat Enterprise Linux (RHEL) 6
- Would like to upgrade server from RHEL 6.x to RHEL 6.y
- Need to upgrade to RHEL 6.x through yum
- Have a secure environment that will never be connected to the internet, but still needs to be updated
- Way to update the packages on server, with no satellite server and servers disconnected from internet
- Offline patches for Red Hat systems
- How do I create a local repository in RHEL 6?
Resolution
Please note: If the system is registered to Red Hat Network, yum can be run with the --noplugins option to prevent it from connecting to RHN. The safer option would be to unregister the system to avoid updating to the latest release.
Note Refer to "How do I set up an up2date or yum repository from a locally-mounted DVD on Red Hat Enterprise Linux?" for other OS versions.
- Download the This content is not included.'Red Hat Enterprise Linux 6 Binary DVD' from the Customer Portal which is approximately 3.6GB
-
Mount the RHEL 6 installation ISO somewhere like
/media/rhel6dvd, e.g.:# mount -o loop Red_Hat_Enterprise_Linux_6.10_DVD.iso /media/rhel6dvdIf you use DVD media, you can mount like below.
# mkdir -p /mnt/disc # mount /dev/sr0 /mnt/disc -
Copy the
media.repofile from the root of the mounted ISO to/etc/yum.repos.d/and set the permissions to something sane, e.g.:# cp /media/rhel6dvd/media.repo /etc/yum.repos.d/rhel6dvd.repo # chmod 644 /etc/yum.repos.d/rhel6dvd.repo -
Edit the new repo file, changing the
gpgcheck=0setting to1and adding the following 3 lines (make sure to replace "Server" with "Client" or "Workstation", depending on the type of RHEL DVD in use):enabled=1 baseurl=file:///media/rhel6dvd/Server gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-releaseIn the end, the new repo file could look like the following (though the
mediaidwill be different depending on the version of RHEL):[dvd-Server] name=DVD for Red Hat Enterprise Linux 6.6 Server mediaid=1359576196.686790 metadata_expire=-1 gpgcheck=1 cost=500 enabled=1 baseurl=file:///media/rhel6dvd/Server gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release -
As a final step, it might be a good idea to run the command
yum clean allonce -
To configure access to the supplementary packages in the directories
HighAvailability,LoadBalancer,ResilientStorage, andScalableFileSystem, add additional repositories for them in the same file, e.g.:[dvd-HighAvailability] mediaid=1359576196.686790 name=DVD for RHEL6 - HighAvailability baseurl=file:///media/rhel6dvd/HighAvailability gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1 [dvd-LoadBalancer] mediaid=1359576196.686790 name=DVD for RHEL6 - LoadBalancer baseurl=file:///media/rhel6dvd/LoadBalancer gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1 [dvd-ResilientStorage] mediaid=1359576196.686790 name=DVD for RHEL6 - ResilientStorage baseurl=file:///media/rhel6dvd/ResilientStorage gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1 [dvd-ScalableFileSystem] mediaid=1359576196.686790 name=DVD for RHEL6 - ScalableFileSystem baseurl=file:///media/rhel6dvd/ScalableFileSystem gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1Note: If using the above example repos, ensure the value of
mediaidis the same as the value from the originalmedia.repofile.
Learn More
See the Red Hat Enterprise Linux 6 Deployment guide for information upgrading the system off-line.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.