centos8系module软件包管理仓库部署

简述

CentOS8 引入新的module软件包管理机制,下面将介绍如何部署搭建本地module源。

部署流程:

思路:

先制作nginx-1.14的module.yaml(需要微调),然后同法制作nginx-1.16的module.yaml(需要微调)。
然后将nginx-1.14与nginx-1.16的repodata都删除,去正在一个完整的repodata
然后将nginx-1.16的module.yaml去掉” document: modulemd-defaults”那部分信息,其他皆最加至nginx-1.14 module.yaml配置文件中。
最后在repodate同级目录下执行createrepo_mod . 去生成module索引。

centos8系module软件包管理仓库部署_第1张图片

1) 先制作nginx-1.14的module:

createrepo -v nginx-1.14/

centos8系module软件包管理仓库部署_第2张图片

2) 给nginx-1.14生成module.yaml文件

注意:repo2module执行前提需要确保和repodata的同级目录下:

repo2module命令再centos8已经集成了rpm默认yum安装即可, 如无请参考官方文档: https://github.com/rpm-software-management/modulemd-tools

cd nginx-1.14/
repo2module .  --module-name nginx1-wei --module-stream 1.14  --module-version 123   --module-context xyz
【参数解析】
--module-name设置module的名
--module-stream 1.14 设置module-stream
--module-version 设置module-version
--module-context xyz 设置--module-context

执行完上面操作后会在当前目录下生成modules.yaml文件 module.yaml微调修改如下

[root@iZ2xxxxxxacZ module]# cat modules.yaml
---
document: modulemd-defaults
version: 1
data:
  module: nginx-wei
  stream: "1.14"        #这里设置的话,就决定在dmf module list的显示1.14 [d]
  profiles:
  1.14: [everything]  #这里的everthing需要改成对应的流,例如guding或者devel
                      #如果还有的其他版本的module可以设置例如:1.16: [xuanzhe]

在这里插入图片描述

...  #<上面这些设置不同nginx的不同版本>
---
document: modulemd
version: 2
data:
  name: nginx-wei
  stream: "1.14"
  version: 123
  context: xyz
  summary: <auto-generated module summary>
  description: >-
    <auto-generated module description>
  license:
    module:
    - MIT
    content:
    - <FILL THIS IN>
  profiles:
    everything:  #这里erverthing改成guding(流)
      rpms:
      - nginx
      - nginx-all-modules
      - nginx-filesystem
      - nginx-mod-http-image-filter
      - nginx-mod-http-perl
      - nginx-mod-http-xslt-filter
      - nginx-mod-mail
      - nginx-mod-stream
  api:
    rpms:
    - nginx
    - nginx-all-modules
    - nginx-filesystem
    - nginx-mod-http-image-filter
    - nginx-mod-http-perl
    - nginx-mod-http-xslt-filter
    - nginx-mod-mail
    - nginx-mod-stream
  components:
    rpms:
      nginx:
        rationale: Present in the repository
  artifacts:
    rpms:
    - nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
    - nginx-all-modules-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch
    - nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch
    - nginx-mod-http-image-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
    - nginx-mod-http-perl-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
    - nginx-mod-http-xslt-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
    - nginx-mod-mail-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
    - nginx-mod-stream-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
...

3) 制作nginx-1.16的module(方法同上):

4) 合并nginx-1.14与module-1.16的module:

  删除nginx-1.14/repodate nginx-1.16/repodata
  重新生成两仓库的yum索引
  将nginx-1.16的module.yaml配置去掉” document: modulemd-defaults”那部分信息,其他的配置都追加到nginx-1.14的module.yaml配置文件中,完整如下
[root@icbbbbbxxx module]# cat /root/module/modules.yaml
---
document: modulemd-defaults
version: 1
data:
  module: nginx-wei
  stream: "1.14"
  profiles:
    1.14: [guding]
    1.16: [xuanze]
...
---
document: modulemd
version: 2
data:
  name: nginx-wei
  stream: "1.14"
  version: 123
  context: f32
  summary: <auto-generated module summary>
  description: >-
    <auto-generated module description>
  license:
    module:
    - MIT
    content:
    - <FILL THIS IN>
  profiles:
    guding:
      rpms:
      - nginx
      - nginx-all-modules
      - nginx-filesystem
      - nginx-mod-http-image-filter
      - nginx-mod-http-perl
      - nginx-mod-http-xslt-filter
      - nginx-mod-mail
      - nginx-mod-stream
  api:
    rpms:
    - nginx
    - nginx-all-modules
    - nginx-filesystem
    - nginx-mod-http-image-filter
    - nginx-mod-http-perl
    - nginx-mod-http-xslt-filter
    - nginx-mod-mail
    - nginx-mod-stream
  components:
    rpms:
      nginx:
        rationale: Present in the repository
  artifacts:
    rpms:
    - nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
    - nginx-all-modules-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch
    - nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch
    - nginx-mod-http-image-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
    - nginx-mod-http-perl-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
    - nginx-mod-http-xslt-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
    - nginx-mod-mail-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
    - nginx-mod-stream-1:1.14.1-9.module_el8.0.0+184+e34fea82.aarch64
...
---   #nginx-1.16的mudule.yaml配置信息加入了下面
document: modulemd
version: 2
data:
  name: nginx-wei
  stream: "1.16"
  version: 456
  context: j23
  summary: <auto-generated module summary>
  description: >-
    <auto-generated module description>
  license:
    module:
    - MIT
    content:
    - <FILL THIS IN>
  profiles:
    xuanze:  #如果想增加类似common devel这样的流,就在api上面在新增数据就行
      rpms:
      - nginx
      - nginx-all-modules
      - nginx-filesystem
      - nginx-mod-http-image-filter
      - nginx-mod-http-perl
      - nginx-mod-http-xslt-filter
      - nginx-mod-mail
      - nginx-mod-stream
  api:
    rpms:
    - nginx
    - nginx-all-modules
    - nginx-filesystem
    - nginx-mod-http-image-filter
    - nginx-mod-http-perl
    - nginx-mod-http-xslt-filter
    - nginx-mod-mail
    - nginx-mod-stream
  components:
    rpms:
      nginx:
        rationale: Present in the repository
  artifacts:
    rpms:
    - nginx-1:1.16.1-2.module_el8.4.0+820+127618ce.1.aarch64
    - nginx-all-modules-1:1.16.1-2.module_el8.4.0+820+127618ce.1.noarch
    - nginx-filesystem-1:1.16.1-2.module_el8.4.0+820+127618ce.1.noarch
    - nginx-mod-http-image-filter-1:1.16.1-2.module_el8.4.0+820+127618ce.1.aarch64
    - nginx-mod-http-perl-1:1.16.1-2.module_el8.4.0+820+127618ce.1.aarch64
    - nginx-mod-http-xslt-filter-1:1.16.1-2.module_el8.4.0+820+127618ce.1.aarch64
    - nginx-mod-mail-1:1.16.1-2.module_el8.4.0+820+127618ce.1.aarch64
    - nginx-mod-stream-1:1.16.1-2.module_el8.4.0+820+127618ce.1.aarch64
...

5) 生成module索引:

在repodata的同级目录下执行createrepo_mod . 来生成module索引

你可能感兴趣的:(release,dnf)