Transfer an offline RPM repository

Move the offline RPM repository tree (from Preparing offline RPMs with subscription repositories) from a connected prep host to an air-gapped target.

Procedure

  1. Plan transfer capacity. Check repository size on the prep machine:
    du -sh /var/rhem-offline-rpms

    Size the USB drive or share quota to fit the tree or archive plus checksum files with headroom.

  2. Choose a filesystem for USB drives:
    • ext4: Linux-native; best performance on Red Hat Enterprise Linux hosts; not readable on Windows or macOS without additional software.
    • exFAT: Cross-platform; readable on Linux, Windows, and macOS; supports files larger than 4 GB.
    Important

    Do not use FAT32 when a single archive exceeds 4 GB. FAT32 cannot store files larger than 4 GB. Use exFAT or ext4 instead, or split the transfer across multiple archives.

  3. Create a tar archive on the prep machine and generate a checksum:
    tar -czf ~/rhem-offline-rpms.tar.gz -C /var rhem-offline-rpms
    sha256sum ~/rhem-offline-rpms.tar.gz | tee ~/rhem-offline-rpms.tar.gz.sha256

    Using -C /var and a relative path keeps archive paths clean.

  4. Copy both the archive and the .sha256 file to the target by using your chosen transfer method.
  5. On the target machine, verify the checksum before you extract or install:
    sha256sum -c ~/rhem-offline-rpms.tar.gz.sha256

    The command must report OK. If verification fails, re-copy the archive from the prep machine; do not install from a corrupt file.

  6. Extract the RPM repository to /var or another path that matches your baseurl in /etc/yum.repos.d/rhem-offline.repo:
    sudo tar -xzf ~/rhem-offline-rpms.tar.gz -C /var

    Confirm repodata/ is present under the path you plan to use for baseurl.

  7. Identify the USB device:
    Warning

    Formatting erases all data on the drive. Run lsblk and confirm the device path before you run mkfs so you do not overwrite the wrong disk.

    lsblk
  8. On the prep machine, format the USB drive if needed, mount it, and copy the repository archive (ext4 example):
    sudo mkfs.ext4 -L rhem-offline /dev/sdb1
    sudo mkdir -p /mnt/usb
    sudo mount /dev/sdb1 /mnt/usb
    cp ~/rhem-offline-rpms.tar.gz ~/rhem-offline-rpms.tar.gz.sha256 /mnt/usb/
    sudo umount /mnt/usb

    For exFAT, install exfatprogs (sudo dnf install -y exfatprogs) and run sudo mkfs.exfat -n rhem-offline /dev/sdb1.

  9. On the target machine, mount the USB drive, copy the archive, extract, and unmount:
    sudo mkdir -p /mnt/usb
    sudo mount /dev/sdb1 /mnt/usb
    cp /mnt/usb/rhem-offline-rpms.tar.gz /mnt/usb/rhem-offline-rpms.tar.gz.sha256 ~/
    sudo umount /mnt/usb
    sha256sum -c ~/rhem-offline-rpms.tar.gz.sha256
    sudo tar -xzf ~/rhem-offline-rpms.tar.gz -C /var
  10. Using ISO images for optical media. ISO images suit read-only media or compliance requirements for immutable archives.
    1. Install xorriso on the prep machine if needed (sudo dnf install -y xorriso).
    2. Create an ISO from the RPM tree:
      xorriso -as mkisofs -o ~/rhem-offline-rpms.iso /var/rhem-offline-rpms
      sha256sum ~/rhem-offline-rpms.iso | tee ~/rhem-offline-rpms.iso.sha256
    3. On the target machine, mount and copy:
      sudo mkdir -p /mnt/iso
      sudo mount -o loop ~/rhem-offline-rpms.iso /mnt/iso
      cp -a /mnt/iso/rhem-offline-rpms /var/
      sudo umount /mnt/iso
  11. Using a network share or jump host. When a restricted network path exists between prep and target hosts, use scp or a temporary HTTP server on the prep machine.
    1. Copy with scp:
      scp ~/rhem-offline-rpms.tar.gz ~/rhem-offline-rpms.tar.gz.sha256 <user>@<target_host>:~/
    2. Or run a temporary HTTP server on the prep machine:
      python3 -m http.server 8080 --directory ~/

      On the target (when it can reach the prep machine on the internal network):

      curl -O http://<prep_host>:8080/rhem-offline-rpms.tar.gz
      curl -O http://<prep_host>:8080/rhem-offline-rpms.tar.gz.sha256
      sha256sum -c rhem-offline-rpms.tar.gz.sha256
      sudo tar -xzf rhem-offline-rpms.tar.gz -C /var

    Stop the HTTP server on the prep machine when the transfer completes.