Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 7 – Red Hat Customer Portal


  • Red Hat Enterprise Linux 7


  • How to set up yum repository to use locally-mounted DVD with Red Hat Enterprise Linux (RHEL) 7
  • Would like to upgrade server from RHEL 7.x to RHEL 7.y
  • 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 7?


  • Mount the RHEL installation ISO to a directory like /mnt/disc, e.g.:

    # mkdir -p  /mnt/disc   # mount -o loop RHEL7.1.iso /mnt/disc   

    If you use DVD media , you can mount like below.

    # mkdir -p  /mnt/disc   # mount /dev/sr0  /mnt/disc   
  • Copy the media.repo file from the root of the mounted directory to /etc/yum.repos.d/ and set the permissions to 0644 or another similar permissions set:

    # cp /mnt/disc/media.repo /etc/yum.repos.d/rhel7dvd.repo   # chmod 644 /etc/yum.repos.d/rhel7dvd.repo   
  • Edit the new repo file, changing the gpgcheck=0 setting to 1 and adding the following 3 lines

    enabled=1   baseurl=file:///mnt/disc/   gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release   

    In the end, the new repo file could look like the following

    [InstallMedia]   name=DVD for Red Hat Enterprise Linux 7.1 Server   mediaid=1359576196.686790   metadata_expire=-1   gpgcheck=1   cost=500   enabled=1   baseurl=file:///mnt/disc/   gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release   
  • Clear the cache and check whether you can get the packages list from the DVD repo

    # yum clean all   # yum list   
  • If no errors are returned, the following can be used to update:

    # yum update   

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.

Shared via Inoreader