SWS Technologies

Nov 22, 2024

Replicating an RHEL / Rocky Linux system without internet access

Export installed packages, move them offline, and restore using dnf and RPMs.

Linux

Author: khelender

Problem: Internet access is missing on the target system.

Need: Set up a new system based on an existing system by capturing all user installed packages and installing them on the remote machine.

Generate a ZIP containing binary installers

dnf history userinstalled > target-packages.lst
mkdir pkgs
cd pkgs
sudo dnf download `cat ../target-packages.lst` --resolve
cd ..
zip -r pkgs.zip pkgs

Copy to target system

Use scp, rsync, OneDrive, or another method to transfer pkgs.zip to the target system.

Install RPM binaries

unzip pkgs.zip
sudo dnf install pkgs/*.rpm

List all installed packages

sudo dnf repoquery --installed --queryformat '%{name}' all-installed-pkgs.lst