Problem Description

We can only install software in a purely intranet (not interoperable with the public network) environment due to many restrictions in the deployment environment, so we need to download the package and install it locally on the server.

The system version is CentOS 8.2, and after using the createrepo command to create the repodata, we get an Error: No available modular metadata for modular package error when installing some software, as shown below.

centos8.x-dnf-install-error-no-modular-metadata.png

To solve the above problem, you need to install software such as modulemd-tools to generate modular metadata. so you can do it under a server with the same system version with network, and finally upload the generated repo package directory to this server in a packaged and compressed way, and finally configure the repo source.

 

Install the modular metadata generation tool

Install the dependencies

$ sudo dnf install gcc gcc-c++ python3 python3-devel python3-createrepo_c python3-libdnf python3-libmodulemd libmodulemd

Download the modulemd-tools source package and install it

$ git clone https://github.com/rpm-software-management/modulemd-tools.git
$ cd modulemd-tools/repo2module/
$ sudo python3 setup.py install --user

 

Create repodata and modular metadata

## Go to the packages directory
$ sudo cd /mnt/packages

# Create repodata
$ sudo createrepo_c .

# Generate modular metadata (recommended to do this under root account, otherwise it may report an error when executed)
$ /root/.local/bin/repo2module -s stable ./
$ modifyrepo_c --mdtype=modules modules.yaml repodata/

After the above step is completed, a file with the suffix -modules.yaml.gz will be created in the repodata directory.

At this point, the package will be installed properly when you do it again.

 

Reference