Skip to content

Instantly share code, notes, and snippets.

@nutrino
Created January 8, 2025 10:59
Show Gist options
  • Save nutrino/74bb7fbe1ef9a7d864a8c1876a3115d5 to your computer and use it in GitHub Desktop.
Save nutrino/74bb7fbe1ef9a7d864a8c1876a3115d5 to your computer and use it in GitHub Desktop.
yum (dnf) downloader for offline installation
#!/bin/bash
set -x #echo on
PKG=$1 # NAME OF THE PACKAGE TO INSTALL ON OFFLINE MACHINE
rm /tmp/modules-$PKG.yaml
rm -rf /tmp/$PKG
rm -rf /tmp/$PKG-installroot
mkdir /tmp/$PKG
mkdir /tmp/$PKG-installroot
yum install -y --downloadonly --installroot=/tmp/$PKG-installroot --releasever=8.6 --downloaddir=/tmp/$PKG $PKG
createrepo -q --database /tmp/$PKG
repo2module --debug --module-name=$PKG --module-stream=stable /tmp/$PKG /tmp/modules-$PKG.yaml
modifyrepo_c --mdtype=modules /tmp/modules-$PKG.yaml /tmp/$PKG/repodata
rm -rf /tmp/$PKG-installroot
tar -cvzf $PKG.tar.gz /tmp/$PKG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment