CentOS – Download RPM and All Dependencies on RHEL/CentOS 8

centosdnfrhelrpmyum

I have a scenario where I need to install an arbitrary list of RPM packages (usually around 5-10 packages) on a server with no network connection. Some packages are from EPEL and I want to avoid having to sync all repos since I need to do this often.

I have solved this for RHEL/CentOS 7 by doing the following:

$ yum -y install epel-release createrepo
$ repotrack $PACKAGE_NAME
$ createrepo --database .

Then I just move this folder onto the server using a USB drive and create a repository file in /etc/yum.repos.d, allowing me to install the package with yum --disablerepo="*" --enablerepo="my-custom-repo" install $PACKAGE_NAME.

Now I am moving this to RHEL/CentOS 8 and while it works for half of my packages, I get the following error for the other half when I do dnf install on the isolated server:

No available modular metadata for modular package 'podman-1.6.4-2.module_el8.1.0+272+3e64ee36.x86_64', it cannot be installed on the system

I figure this is due to the new modular system and my repo does not have all the necessary info. I have tried to read the manual for both repotrack and createrepo but none of them seem to mention modules. Searching the Internet just gave me solutions for 7, which I already have, but I failed to find anything for 8 and packages that belongs to modules in particular.

So how do I fetch RHEL/CentOS 8 packages belonging to modules, and all their dependencies, to disk, so I can then move them to another server and install them there?

Thanks!

Best Answer

Take a look at the modulemd-tools project. You can find precompiled binaries in EPEL.

Assuming you have several modular rpms in ./my-custom-repo/Packages:

modular rpms names like python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64.rpm

Run:

cd my-custom-repo
# create traditional rpm repo
createrepo_c .
# generate modules meta info
repo2module  -s stable -d . modules.yaml
# adjust modules meta info to traditional rpm repo
modifyrepo_c --mdtype=modules modules.yaml repodata/

After all this work, you can find a file names like xxxx-modules.yaml.gz in repodata dir.

The repo should work now.

Related Question