5.4. 定义自定义默认模块流和配置文件
Red Hat Enterprise Linux 9 不会在 AppStream 存储库中定义默认流。但是,您可以配置默认模块流和默认模块配置文件。在这种情况下,您可以在安装模块的默认流和配置文件时忽略此信息。
流程
使用
dnf module list <module_name>
命令显示可用的流及其配置文件,例如:# dnf module list nodejs Name Stream Profiles Summary nodejs 18 common [d], development, minimal, s2i Javascript runtime
在本例中,
nodejs:18
没有被设置为默认流,此流中的默认配置文件是common
。在
/etc/dnf/modules.defaults.d/
目录中创建一个 YAML 文件,以定义模块的默认流和配置文件。例如,使用以下内容创建
/etc/dnf/modules.defaults.d/nodejs.yaml
文件,来将18
定义为nodejs
模块的默认流,将minimal
定义为默认配置文件:document: modulemd-defaults version: 1 data: module: nodejs stream: "18" profiles: '18': [minimal]
验证
使用
dnf module list <module_name>
命令来验证新的默认流和配置文件设置,例如:# dnf module list nodejs Name Stream Profiles Summary nodejs 18 [d] common, development, minimal [d], s2i Javascript runtime