在自建本地仓库时,遇到中科方德操作系统适配yum源问题,由于适配的新版中科方德系统是基于el8.5制作,根据以往经验只用了creatrepo来生成repodate数据,在安装docker相关的包时,出现No available modular metadata for modular package报错。具体如下:

解决自建仓库中含el8系统包没有modular元数据问题_centos

目前可行的解决方案:

1、下载centos8.4的镜像,提供相应的环境,进入镜像改为阿里的repo文件

docker pull centos:centos8.4.2105

docker run -it --rm centos:centos8.4.2105bash

cd  /etc/yum.repos.d/&& mkdir bak && mv CentOS-Linux-* bak

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

yum clean all && yum makecache

2、Installation instructions

The modulemd-tools package is available in the official Fedora repositories, and RHEL 8.5 and higher. As such, it can be easily installed with:

dnf install modulemd-tools

3、Use cases:Creating a module repository from a regular repository

Let's assume that we have a regular (meaning non-modular) repository.

$ ls

hello-2.8-1.fc32.x86_64.rpm  repodata

We might want to convert this repository to a modular repository, i.e. creating a module providing current packages and then making the module available through the repository. It is a two-stepprocess.

First, generate a modulemd YAML providing all repository packages.

$ repo2module . \

--module-name foo \

--module-stream devel \

--module-version 123 \

--module-context f32

This command generates a modules.yaml file, you might want to open it in a text editor and review its contents.

$ ls

hello-2.8-1.fc32.x86_64.rpm  modules.yaml  repodata

Once the modules.yaml fits your expectations (it shouldn't require any changes for the tooling to work, you might want to fill in just some information for its users), re-create the repository to provide the module. For that, use createrepo_mod, or createrepo_c in the 0.16.1 version and above. They both accept the same parameters.

$ createrepo_mod .

Optionally, check that the module metadata is available within the repository.

$ ls repodata/ |grep modules

c92f0efc3db47c5c8875665699781d001d9a78afdb49fab301b19d84968932f8-modules.yaml.gz