DNF如何优化处理模块化基础设施?

2026-05-25 16:063阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计649个文字,预计阅读时间需要3分钟。

DNF如何优化处理模块化基础设施?

从RHEL8/CentOS8开始,使用dnf取代yum作为包管理工具。此外,还引入了模块(module)这一概念,简化了在同一OS上安装不同版本软件或开发语言的作业。

引言

从RHEL8/CentOS8开始,dnf取代yum作为rpm 包管理工具。与之而来的还有模块(module)这个东西。 有了它们的加持,让在同一个OS上安装不同版本的软件或者开发语言的工作比之前容易多了。

简介

Modulesare special package groups usually representing an application, a language runtime, or a set of tools. They are available in one ormultiple streamswhich usually represent a major version of a piece of software, giving you an option to choose what versions of packages you want to consume.

To simplify installation, modules usually define one or moreinstallation profilesthat represent a specific use case. For example aserveror aclientprofile in a database module.

也就是说:

一个软件可以有多个版本,每个版本对应一个stream. 在每个stream内部,又分为proile对应到安装场景(比如开发, server, client)。

实际dnf使用中的要点

如果module有多个stream(版本),会有一个是默认的, 在dnf命令输出里面在stream name后用[d]表示

如果某个stream有多个profiles, 会有一个默认的,在dnf命令输出里面在profile name后用[d]表示

Module install

语法

$ dnf module install NAME $ dnf module install NAME:STREAM $ dnf module install NAME/PROFILE $ dnf module install NAME:STREAM/PROFILE 下面以nginx举例

$ sudo dnf module list nginx Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) Name Stream Profiles Summary nginx 1.14 [d] common [d] nginx webserver nginx 1.16 common [d] nginx webserver nginx 1.18 common [d] nginx webserver nginx 1.20 common [d] nginx webserver Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

解读output:

nginx module 有4个stream(对应4个版本),默认安装的是1.14,1.14这个stream只有一个profile “common”, 它也是默认安装的profile

例子: 查看已经安装的module

$ dnf module list --installed Name Stream Profiles Summary nodejs 14 [e] common [d] [i], development, minimal, s2i Javascript runtime python39 3.9 [d][e] build, common [d] [i] Python programming language, version 3.9 Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

dnf module list --installed 显示已经安装的module

查看输出 nodejs这一行表示:

14 [e]: 表示14这个版本(stream)已经启用了,用[e]表示. 这里[e]就肯定说明已经安装了

common [d] [i], development, minimal, s2i : 共4个profiles: common, devleopment, mininal, s2i。 其中common 是默认的Profile,用[d]表示,而且它已经安装在本机了,用[i]表示

查看输出 python39这一行表示:

3.9 [d] [3]: 3.9这个版本(stream)是这个module的缺省版本,用[d]表示;而且是已经启用了,用[e]表示。 这里[e]就肯定说明已经安装了

Refer

docs.fedoraproject.org/en-US/modularity/using-modules/

DNF如何优化处理模块化基础设施?

本文共计649个文字,预计阅读时间需要3分钟。

DNF如何优化处理模块化基础设施?

从RHEL8/CentOS8开始,使用dnf取代yum作为包管理工具。此外,还引入了模块(module)这一概念,简化了在同一OS上安装不同版本软件或开发语言的作业。

引言

从RHEL8/CentOS8开始,dnf取代yum作为rpm 包管理工具。与之而来的还有模块(module)这个东西。 有了它们的加持,让在同一个OS上安装不同版本的软件或者开发语言的工作比之前容易多了。

简介

Modulesare special package groups usually representing an application, a language runtime, or a set of tools. They are available in one ormultiple streamswhich usually represent a major version of a piece of software, giving you an option to choose what versions of packages you want to consume.

To simplify installation, modules usually define one or moreinstallation profilesthat represent a specific use case. For example aserveror aclientprofile in a database module.

也就是说:

一个软件可以有多个版本,每个版本对应一个stream. 在每个stream内部,又分为proile对应到安装场景(比如开发, server, client)。

实际dnf使用中的要点

如果module有多个stream(版本),会有一个是默认的, 在dnf命令输出里面在stream name后用[d]表示

如果某个stream有多个profiles, 会有一个默认的,在dnf命令输出里面在profile name后用[d]表示

Module install

语法

$ dnf module install NAME $ dnf module install NAME:STREAM $ dnf module install NAME/PROFILE $ dnf module install NAME:STREAM/PROFILE 下面以nginx举例

$ sudo dnf module list nginx Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) Name Stream Profiles Summary nginx 1.14 [d] common [d] nginx webserver nginx 1.16 common [d] nginx webserver nginx 1.18 common [d] nginx webserver nginx 1.20 common [d] nginx webserver Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

解读output:

nginx module 有4个stream(对应4个版本),默认安装的是1.14,1.14这个stream只有一个profile “common”, 它也是默认安装的profile

例子: 查看已经安装的module

$ dnf module list --installed Name Stream Profiles Summary nodejs 14 [e] common [d] [i], development, minimal, s2i Javascript runtime python39 3.9 [d][e] build, common [d] [i] Python programming language, version 3.9 Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

dnf module list --installed 显示已经安装的module

查看输出 nodejs这一行表示:

14 [e]: 表示14这个版本(stream)已经启用了,用[e]表示. 这里[e]就肯定说明已经安装了

common [d] [i], development, minimal, s2i : 共4个profiles: common, devleopment, mininal, s2i。 其中common 是默认的Profile,用[d]表示,而且它已经安装在本机了,用[i]表示

查看输出 python39这一行表示:

3.9 [d] [3]: 3.9这个版本(stream)是这个module的缺省版本,用[d]表示;而且是已经启用了,用[e]表示。 这里[e]就肯定说明已经安装了

Refer

docs.fedoraproject.org/en-US/modularity/using-modules/

DNF如何优化处理模块化基础设施?