• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL 6 : How to setup yum repository using locally mounted DVD

by admin

A yum repository (or “repo” for short) is a collection of RPMs in a single location, for example, on a web site or in a directory on a DVD. In RHEL 6.0 Snapshot 12 there are 5 repositories:
1. HighAvailability
2. LoadBalancer
3. ResilientStorage
4. ScalableFileSystem
5. Server

The Server repo is the main repo with the usual packages (httpd, glibc, bash, coreutils, etc). The other 4 are specialty add-on repos for packages; for example, to help with a Load Balancing web server.

There may be cases when you can not update the server using a satellite server or have a secure environment that will never be connected to the Internet but still needs to be updated. Well, there is a way out. You can locally mount the RHEL 6 DVD ISO and use it as your yum repository.

Configuring yum repository using locally mounted DVD

1. Mount the RHEL 6 installation ISO somewhere like /mnt, e.g.:

# mount -o loop rhel6.iso /mnt
Also read : Linux / UNIX : How to mount an iso file

2. Copy the media.repo file from the root of the mounted ISO to /etc/yum.repos.d/ and set the permissions. e.g.:

# cp /mnt/media.repo /etc/yum.repos.d/rhel6dvd.repo
# chmod 644 /etc/yum.repos.d/rhel6dvd.repo
3. Edit the new repo file, change the gpgcheck=0 setting to 1 and add 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:///mnt/rhel6dvd/Server
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

4. In the end, the new repo file could look like the following (though the media-id will 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:///mnt/rhel6dvd/Server
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

5. As a final step, it might be a good idea to run the command yum clean all once.

# yum clean all

How to add optional repositories

To configure access to the supplementary packages in the directories HighAvailability, LoadBalancer, ResilientStorage, and ScalableFileSystem, add additional repositories for them in the same file, e.g.:

[dvd-HighAvailability]
mediaid=1359576196.686790
name=DVD for RHEL6 - HighAvailability
baseurl=file:///mnt/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:///mnt/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:///mnt/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:///mnt/rhel6dvd/ScalableFileSystem
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1
gpgcheck=1
Note: If using the above example repos, ensure the value of mediaid is the same as the value from the original media.repo file.
CentOS / RHEL 7 : How to setup yum repository using locally mounted DVD

Filed Under: Linux

Some more articles you might also be interested in …

  1. Understanding the rc Scripts in Linux
  2. ifrename: command not found
  3. nm : Command to list the symbols in object files.
  4. How to Install GUI On CentOS/RHEL 8
  5. finch: command not found
  6. asciiart Command Examples in Linux
  7. How to enable core dump for Applications on CentOS/RHEL
  8. nano: command not found
  9. conntrack: command not found
  10. Extend the Size of /boot Partition on XFS Filesystem (CentOS/RHEL 7)

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright