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
-
Plan transfer capacity. Check repository size on the prep machine:
du -sh /var/rhem-offline-rpmsSize the USB drive or share quota to fit the tree or archive plus checksum files with headroom.
-
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.
-
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.sha256Using
-C /varand a relative path keeps archive paths clean. -
Copy both the archive and the
.sha256file to the target by using your chosen transfer method. -
On the target machine, verify the checksum before you extract or install:
sha256sum -c ~/rhem-offline-rpms.tar.gz.sha256The command must report
OK. If verification fails, re-copy the archive from the prep machine; do not install from a corrupt file. -
Extract the RPM repository to
/varor another path that matches yourbaseurlin/etc/yum.repos.d/rhem-offline.repo:sudo tar -xzf ~/rhem-offline-rpms.tar.gz -C /varConfirm
repodata/is present under the path you plan to use forbaseurl. -
Identify the USB device:
Warning Formatting erases all data on the drive. Run
lsblkand confirm the device path before you runmkfsso you do not overwrite the wrong disk.lsblk -
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/usbFor exFAT, install
exfatprogs(sudo dnf install -y exfatprogs) and runsudo mkfs.exfat -n rhem-offline /dev/sdb1. -
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 -
Using ISO images for optical media. ISO images suit read-only media or compliance requirements for immutable archives.
-
Install
xorrisoon the prep machine if needed (sudo dnf install -y xorriso). -
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 -
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
-
Install
-
Using a network share or jump host. When a restricted network path exists between prep and target hosts, use
scpor a temporary HTTP server on the prep machine.-
Copy with
scp:scp ~/rhem-offline-rpms.tar.gz ~/rhem-offline-rpms.tar.gz.sha256 <user>@<target_host>:~/ -
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.
-
Copy with