Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 5
Environment
- Red Hat Enterprise Linux 5
Issue
- How to set up yum repository to use locally-mounted DVD with Red Hat Enterprise Linux 5?
- Would like to upgrade server from Red Hat Enterprise Linux 5.x to Red Hat Enterprise Linux 5.y
- Need to upgrade to Red Hat Enterprise Linux 5.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 can I create a local repository in Red Hat Enterprise Linux 5?
- How can I create a local repo in Red Hat Enterprise Linux 5?
Resolution
Automatic configuration
Red Hat Customer Portal Labs provides a [Yum Repository Configuration Helper](https://access.redhat.com/labs/yumrepoconfighelper/) for automatically setting up a yum repository, based on your environment and deployment goals. The [Yum Repository Configuration Helper](https://access.redhat.com/labs/yumrepoconfighelper/) incorporates the information included in this document but makes it easier to generate valid and support-recommended configurations.
Manual configuration
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.
-
Mount the Red Hat Enterprise Linux 5 installation ISO somewhere like
/media/rhel5dvd, e.g.:# mount -o loop RHEL5.9-Server-20121129.0-x86_64-DVD.iso /media/rhel5dvdIf you use DVD media, you can mount like below.
# mkdir -p /mnt/disc # mount /dev/sr0 /mnt/disc -
Check the numeric value found on the first line of the
.discinfofile from the mounted DVD# head -n1 /media/rhel5dvd/.discinfo 1354216429.587870 -
Create a new file in
/etc/yum.repos.d/, e.g./etc/yum.repos.d/dvd.repoand add the following content to it[dvd-Server] mediaid=1354216429.587870 name=RHEL 5 Server DVD baseurl=file:///media/rhel5dvd/Server gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1Customize the file appropriately, i.e.:
- The value of
baseurlmust match up with where the DVD was mounted in step #1 - If using Red Hat Enterprise Linux Client or Workstation, the last directory in the
baseurlwill need to be changed toClient - Set the numeric value found from
.discinfofile tomediaid.
- The value of
-
As a final step, it might be a good idea to run the command
yum clean allonce
Also note that if the system is not registered to Red Hat Network,yumcan be run with the--nopluginsoption to prevent it from connecting to RHN
How to add optional repository
To configure access to the supplementary packages in the directories Cluster, ClusterStorage, VT, add additional repositories for them in the same file, e.g.:
[dvd-cluster]
mediaid=1354216429.587870
name=DVD for RHEL5 - Cluster
baseurl=file:///media/rhel5dvd/Cluster
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1
gpgcheck=1
[dvd-cluster-storage]
mediaid=1354216429.587870
name=DVD for RHEL5 - ClusterStorage
baseurl=file:///media/rhel5dvd/ClusterStorage
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1
gpgcheck=1
[dvd-vt]
mediaid=1354216429.587870
name=DVD for RHEL5 - VT
baseurl=file:///media/rhel5dvd/VT
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1
gpgcheck=1
# Note: Make sure to customize the above as in step #3.
Optional and specific to Red Hat Enterprise Linux 5 Client: To configure access to the packages in the Workstation directory, add a repo stanza to the above file for that as well, e.g.:
[dvd-workstation]
mediaid=1354233478.680018
name=DVD for RHEL5 - Workstation
baseurl=file:///media/rhel5dvd/Workstation
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1
gpgcheck=1
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.