Configure Local DVD Repository for RHEL 8 and later

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 10

Issue

  • How to set up yum repository to use locally-mounted DVD with Red Hat Enterprise Linux?
  • Would like to upgrade server locally using ISO
  • Have a secure environment that will never be connected to the internet, but still needs to be updated
  • Is there a way to update the packages on server, with no satellite server and servers disconnected from internet
  • How to apply offline patches for Red Hat systems using Binary DVD ISO ?
  • How do I create a local repository using ISO

Resolution

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 Binary DVD' from the Customer Portal

       RHEL 8 example:
       rhel-8.x-x86_64-dvd.iso
    
       RHEL 9 example:
       rhel-9.x-x86_64-dvd.iso
    
       RHEL 10 example:
       rhel-10.x-x86_64-dvd.iso
    
  • Mount the RHEL Binary DVD ISO to a directory such as /mnt/disc, e.g.:

       # mkdir -p  /mnt/disc
    
       # For RHEL 8
       # mount -o loop rhel-8.x-x86_64-dvd.iso /mnt/disc    
    
       # For RHEL 9
       # mount -o loop rhel-9.x-x86_64-dvd.iso /mnt/disc    
       
       # For RHEL 10
       # mount -o loop rhel-10.x-x86_64-dvd.iso /mnt/disc  
    
  • If you use DVD media, you can mount it as follows,

    # mkdir -p  /mnt/disc
    # mount /dev/sr0  /mnt/disc
    

Note: The Warning mount: /mnt/disc: WARNING: source write-protected, mounted read-only. is expected.

  • Create the repository file with the correct path where the DVD or ISO is mounted,

    # vi /etc/yum.repos.d/rheldvd.repo 
    [BaseOS]
    name=BaseOS Packages Red Hat Enterprise Linux 
    metadata_expire=-1
    gpgcheck=1
    enabled=1
    baseurl=file:///mnt/disc/BaseOS/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
    
    [AppStream]
    name=AppStream Packages Red Hat Enterprise Linux 
    metadata_expire=-1
    gpgcheck=1
    enabled=1
    baseurl=file:///mnt/disc/AppStream/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
    
  • Clear the cache and check whether you are able to get the packages from this DVD repository,

    # yum clean all
    # yum repolist
    
  • If are no errors, then you can consider Installing/Updating the Packages with,

    # yum install <Package-Name>
    # yum check-update 
    # yum update 
    
SBR
Components
Category

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.