1.8 Creating a Local Yum Repository by Using an ISO Image

Note

The system must have sufficient storage space to host a full Oracle Linux Media Pack DVD image (approximately 6.6 GB for Oracle Linux 8).

To create a local yum repository (for example, if a system does not have Internet access):

  1. On a system with Internet access, download a full Oracle Linux DVD image from the Oracle Software Delivery Cloud at https://edelivery.oracle.com/linux onto removable storage (such as a USB memory stick).

    Note

    You can verify that the ISO was copied correctly by comparing its checksum with the digest value that is listed on edelivery.oracle.com, for example:

    # sha1sum OracleLinux8.iso
    203b8185d8c6551378b41da26b088f23e131343f OracleLinux8.iso
  2. Transfer the removable storage to the system on which you want to create a local yum repository, and copy the DVD image to a directory in a local file system.

    # cp /media/USB_stick/OracleLinux8.iso /ISOs
  3. Create a suitable mount point, for example /var/OSimage/OL8_x86_64, and mount the DVD image on it.

    # mkdir -p /var/OSimage/OL8_x86_64
    # mount -o loop,ro /ISOs/OracleLinux8.iso /var/OSimage/OL8_x86_64
    Note

    Include the read-only mount option (ro) to avoid changing the contents of the ISO by mistake.

  4. Create an entry in /etc/fstab so that the system always mounts the DVD image after a reboot.

    /ISOs/OracleLinux8.iso /var/OSimage/OL8.0_x86_64 iso9660 loop,ro 0 0
  5. Disable all existing yum repositories.

    In the /etc/yum.repos.d directory, edit any existing repository files and disable all entries by setting enabled=0. Alternately, as described in Section 1.2.4, “Using the DNF config-manager Plugin”, you can disable all repositories by running:

    # dnf config-manager --disable \*
  6. Create the following entries in a new repository file (for example, /etc/yum.repos.d/OL8.repo).

    [OL8]
    name=Oracle Linux 8.0 x86_64
    baseurl=file:///var/OSimage/OL8_x86_64
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
    gpgcheck=1 
    enabled=1 
  7. Clean up the dnf cache.

    # dnf clean all
  8. Test that you can use the dnf command to access the repository.

    # dnf repolist
    Loaded plugins: refresh-packagekit, security
    ...
    repo id                          repo name                                status
    OL8                             Oracle Linux 8.0 x86_64                  5,070
    repolist: 5,070