Yum 与 DNF:Linux 包管理的"父子恩仇录"
在 Linux 的世界里,安装软件就像点外卖------你只需要动动嘴(敲敲命令),剩下的让包管理器去操心。今天我们要聊的,就是 Red Hat 系的两代"外卖小哥":Yum 和 DNF。
一、先讲个故事:老爸 Yum 的光辉岁月
很久很久以前(其实也就2003年),Fedora 社区里诞生了一个叫 Yum (Yellowdog Updater, Modified)的家伙。他的使命很朴素却也很伟大:帮你自动解决软件依赖问题。
在 Yum 出现之前,用 RPM 装软件就像徒手搭乐高------你装一个包,它告诉你缺 A,你去找 A,A 又告诉你缺 B,你再去装 B......恭喜你,已经陷进传说中的**"依赖地狱"**了。
Yum 横空出世,拍拍胸脯说:"交给我!"------它自动下载、自动解析依赖、自动安装,简直就是那个年代的程序员之友。
#mermaid-svg-Cmka3iSnglyzzuTX{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Cmka3iSnglyzzuTX .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Cmka3iSnglyzzuTX .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Cmka3iSnglyzzuTX .error-icon{fill:#552222;}#mermaid-svg-Cmka3iSnglyzzuTX .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Cmka3iSnglyzzuTX .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Cmka3iSnglyzzuTX .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Cmka3iSnglyzzuTX .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Cmka3iSnglyzzuTX .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Cmka3iSnglyzzuTX .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Cmka3iSnglyzzuTX .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Cmka3iSnglyzzuTX .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Cmka3iSnglyzzuTX .marker.cross{stroke:#333333;}#mermaid-svg-Cmka3iSnglyzzuTX svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Cmka3iSnglyzzuTX p{margin:0;}#mermaid-svg-Cmka3iSnglyzzuTX .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-Cmka3iSnglyzzuTX .cluster-label text{fill:#333;}#mermaid-svg-Cmka3iSnglyzzuTX .cluster-label span{color:#333;}#mermaid-svg-Cmka3iSnglyzzuTX .cluster-label span p{background-color:transparent;}#mermaid-svg-Cmka3iSnglyzzuTX .label text,#mermaid-svg-Cmka3iSnglyzzuTX span{fill:#333;color:#333;}#mermaid-svg-Cmka3iSnglyzzuTX .node rect,#mermaid-svg-Cmka3iSnglyzzuTX .node circle,#mermaid-svg-Cmka3iSnglyzzuTX .node ellipse,#mermaid-svg-Cmka3iSnglyzzuTX .node polygon,#mermaid-svg-Cmka3iSnglyzzuTX .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Cmka3iSnglyzzuTX .rough-node .label text,#mermaid-svg-Cmka3iSnglyzzuTX .node .label text,#mermaid-svg-Cmka3iSnglyzzuTX .image-shape .label,#mermaid-svg-Cmka3iSnglyzzuTX .icon-shape .label{text-anchor:middle;}#mermaid-svg-Cmka3iSnglyzzuTX .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Cmka3iSnglyzzuTX .rough-node .label,#mermaid-svg-Cmka3iSnglyzzuTX .node .label,#mermaid-svg-Cmka3iSnglyzzuTX .image-shape .label,#mermaid-svg-Cmka3iSnglyzzuTX .icon-shape .label{text-align:center;}#mermaid-svg-Cmka3iSnglyzzuTX .node.clickable{cursor:pointer;}#mermaid-svg-Cmka3iSnglyzzuTX .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Cmka3iSnglyzzuTX .arrowheadPath{fill:#333333;}#mermaid-svg-Cmka3iSnglyzzuTX .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Cmka3iSnglyzzuTX .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Cmka3iSnglyzzuTX .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Cmka3iSnglyzzuTX .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Cmka3iSnglyzzuTX .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Cmka3iSnglyzzuTX .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Cmka3iSnglyzzuTX .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Cmka3iSnglyzzuTX .cluster text{fill:#333;}#mermaid-svg-Cmka3iSnglyzzuTX .cluster span{color:#333;}#mermaid-svg-Cmka3iSnglyzzuTX div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Cmka3iSnglyzzuTX .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Cmka3iSnglyzzuTX rect.text{fill:none;stroke-width:0;}#mermaid-svg-Cmka3iSnglyzzuTX .icon-shape,#mermaid-svg-Cmka3iSnglyzzuTX .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Cmka3iSnglyzzuTX .icon-shape p,#mermaid-svg-Cmka3iSnglyzzuTX .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Cmka3iSnglyzzuTX .icon-shape .label rect,#mermaid-svg-Cmka3iSnglyzzuTX .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Cmka3iSnglyzzuTX .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Cmka3iSnglyzzuTX .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Cmka3iSnglyzzuTX :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 没有Yum的日子
装软件
缺少依赖A
手动找A
缺少依赖B
手动找B
缺少依赖C
......崩溃了😭
用户
RPM
RPM
RPM
陷入依赖地狱
二、Yum 是怎么干活的?(架构图来了)
Yum 的架构其实非常清晰,核心思路就三件事:找源 → 解依赖 → 装包。
#mermaid-svg-lo2hI566kyCkYrhV{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-lo2hI566kyCkYrhV .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-lo2hI566kyCkYrhV .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-lo2hI566kyCkYrhV .error-icon{fill:#552222;}#mermaid-svg-lo2hI566kyCkYrhV .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-lo2hI566kyCkYrhV .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-lo2hI566kyCkYrhV .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-lo2hI566kyCkYrhV .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-lo2hI566kyCkYrhV .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-lo2hI566kyCkYrhV .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-lo2hI566kyCkYrhV .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-lo2hI566kyCkYrhV .marker{fill:#333333;stroke:#333333;}#mermaid-svg-lo2hI566kyCkYrhV .marker.cross{stroke:#333333;}#mermaid-svg-lo2hI566kyCkYrhV svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-lo2hI566kyCkYrhV p{margin:0;}#mermaid-svg-lo2hI566kyCkYrhV .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-lo2hI566kyCkYrhV .cluster-label text{fill:#333;}#mermaid-svg-lo2hI566kyCkYrhV .cluster-label span{color:#333;}#mermaid-svg-lo2hI566kyCkYrhV .cluster-label span p{background-color:transparent;}#mermaid-svg-lo2hI566kyCkYrhV .label text,#mermaid-svg-lo2hI566kyCkYrhV span{fill:#333;color:#333;}#mermaid-svg-lo2hI566kyCkYrhV .node rect,#mermaid-svg-lo2hI566kyCkYrhV .node circle,#mermaid-svg-lo2hI566kyCkYrhV .node ellipse,#mermaid-svg-lo2hI566kyCkYrhV .node polygon,#mermaid-svg-lo2hI566kyCkYrhV .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-lo2hI566kyCkYrhV .rough-node .label text,#mermaid-svg-lo2hI566kyCkYrhV .node .label text,#mermaid-svg-lo2hI566kyCkYrhV .image-shape .label,#mermaid-svg-lo2hI566kyCkYrhV .icon-shape .label{text-anchor:middle;}#mermaid-svg-lo2hI566kyCkYrhV .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-lo2hI566kyCkYrhV .rough-node .label,#mermaid-svg-lo2hI566kyCkYrhV .node .label,#mermaid-svg-lo2hI566kyCkYrhV .image-shape .label,#mermaid-svg-lo2hI566kyCkYrhV .icon-shape .label{text-align:center;}#mermaid-svg-lo2hI566kyCkYrhV .node.clickable{cursor:pointer;}#mermaid-svg-lo2hI566kyCkYrhV .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-lo2hI566kyCkYrhV .arrowheadPath{fill:#333333;}#mermaid-svg-lo2hI566kyCkYrhV .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-lo2hI566kyCkYrhV .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-lo2hI566kyCkYrhV .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-lo2hI566kyCkYrhV .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-lo2hI566kyCkYrhV .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-lo2hI566kyCkYrhV .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-lo2hI566kyCkYrhV .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-lo2hI566kyCkYrhV .cluster text{fill:#333;}#mermaid-svg-lo2hI566kyCkYrhV .cluster span{color:#333;}#mermaid-svg-lo2hI566kyCkYrhV div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-lo2hI566kyCkYrhV .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-lo2hI566kyCkYrhV rect.text{fill:none;stroke-width:0;}#mermaid-svg-lo2hI566kyCkYrhV .icon-shape,#mermaid-svg-lo2hI566kyCkYrhV .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-lo2hI566kyCkYrhV .icon-shape p,#mermaid-svg-lo2hI566kyCkYrhV .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-lo2hI566kyCkYrhV .icon-shape .label rect,#mermaid-svg-lo2hI566kyCkYrhV .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-lo2hI566kyCkYrhV .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-lo2hI566kyCkYrhV .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-lo2hI566kyCkYrhV :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 依赖解析
缓存层
仓库层
Yum核心层
用户层
查询已装包
读取 repo 配置
读取 repo 配置
读取 repo 配置
下载并缓存
调用
输出安装/卸载列表
rpm -i
yum install 软件包
Yum CLI 前端
RPM 本地数据库
Base 仓库
EPEL 仓库
Updates 仓库
/var/cache/yum
元数据缓存
依赖求解器
自动计算依赖链
已安装软件包
Yum 的工作流其实就像你去食堂打饭------看看菜单(repo),想想今天吃啥(依赖解析),然后阿姨给你一顿猛打(安装)。
三、Yum 老了,DNF 来接班
Yum 用了十几年,慢慢的,大家发现这老伙计有几个**"慢性病"**:
| Yum 的毛病 | 症状 |
|---|---|
| Python 2 依赖 | Python 2 都退休了,Yum 还赖在上面不走 |
| 依赖解析慢 | 用的是自己写的 C 扩展,算法不给力,算依赖像在数绵羊 |
| 内存泄漏 | 用久了就"吃内存",跟 Chrome 浏览器一个德性 |
| API 混乱 | 源码乱成一锅粥,维护者看了想辞职 |
| 并发能力差 | 一次只能干一件事,多任务?不存在的 |
于是,2012年 Fedora 18 带来了新同学------DNF (DaNdiFied Yum)。名字很拗口对吧?其实它自己人也觉得拗口,后来又强行解释为 Dandified Yum("被包装过的 Yum",听着像前女友化了妆回来找你)。
#mermaid-svg-cp8w3YyR1b0xejAO{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-cp8w3YyR1b0xejAO .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-cp8w3YyR1b0xejAO .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-cp8w3YyR1b0xejAO .error-icon{fill:#552222;}#mermaid-svg-cp8w3YyR1b0xejAO .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-cp8w3YyR1b0xejAO .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-cp8w3YyR1b0xejAO .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-cp8w3YyR1b0xejAO .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-cp8w3YyR1b0xejAO .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-cp8w3YyR1b0xejAO .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-cp8w3YyR1b0xejAO .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-cp8w3YyR1b0xejAO .marker{fill:#333333;stroke:#333333;}#mermaid-svg-cp8w3YyR1b0xejAO .marker.cross{stroke:#333333;}#mermaid-svg-cp8w3YyR1b0xejAO svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-cp8w3YyR1b0xejAO p{margin:0;}#mermaid-svg-cp8w3YyR1b0xejAO .edge{stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .section--1 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section--1 path,#mermaid-svg-cp8w3YyR1b0xejAO .section--1 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section--1 path{fill:hsl(240, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section--1 text{fill:#ffffff;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon--1{font-size:40px;color:#ffffff;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge--1{stroke:hsl(240, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth--1{stroke-width:17;}#mermaid-svg-cp8w3YyR1b0xejAO .section--1 line{stroke:hsl(60, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:#ffffff;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-0 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-0 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-0 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-0 path{fill:hsl(60, 100%, 73.5294117647%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-0 text{fill:black;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-0{font-size:40px;color:black;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-0{stroke:hsl(60, 100%, 73.5294117647%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-0{stroke-width:14;}#mermaid-svg-cp8w3YyR1b0xejAO .section-0 line{stroke:hsl(240, 100%, 83.5294117647%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:black;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-1 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-1 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-1 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-1 path{fill:hsl(80, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-1 text{fill:black;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-1{font-size:40px;color:black;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-1{stroke:hsl(80, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-1{stroke-width:11;}#mermaid-svg-cp8w3YyR1b0xejAO .section-1 line{stroke:hsl(260, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:black;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-2 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-2 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-2 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-2 path{fill:hsl(270, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-2 text{fill:#ffffff;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-2{font-size:40px;color:#ffffff;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-2{stroke:hsl(270, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-2{stroke-width:8;}#mermaid-svg-cp8w3YyR1b0xejAO .section-2 line{stroke:hsl(90, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:#ffffff;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-3 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-3 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-3 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-3 path{fill:hsl(300, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-3 text{fill:black;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-3{font-size:40px;color:black;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-3{stroke:hsl(300, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-3{stroke-width:5;}#mermaid-svg-cp8w3YyR1b0xejAO .section-3 line{stroke:hsl(120, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:black;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-4 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-4 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-4 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-4 path{fill:hsl(330, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-4 text{fill:black;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-4{font-size:40px;color:black;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-4{stroke:hsl(330, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-4{stroke-width:2;}#mermaid-svg-cp8w3YyR1b0xejAO .section-4 line{stroke:hsl(150, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:black;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-5 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-5 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-5 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-5 path{fill:hsl(0, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-5 text{fill:black;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-5{font-size:40px;color:black;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-5{stroke:hsl(0, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-5{stroke-width:-1;}#mermaid-svg-cp8w3YyR1b0xejAO .section-5 line{stroke:hsl(180, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:black;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-6 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-6 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-6 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-6 path{fill:hsl(30, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-6 text{fill:black;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-6{font-size:40px;color:black;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-6{stroke:hsl(30, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-6{stroke-width:-4;}#mermaid-svg-cp8w3YyR1b0xejAO .section-6 line{stroke:hsl(210, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:black;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-7 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-7 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-7 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-7 path{fill:hsl(90, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-7 text{fill:black;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-7{font-size:40px;color:black;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-7{stroke:hsl(90, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-7{stroke-width:-7;}#mermaid-svg-cp8w3YyR1b0xejAO .section-7 line{stroke:hsl(270, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:black;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-8 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-8 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-8 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-8 path{fill:hsl(150, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-8 text{fill:black;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-8{font-size:40px;color:black;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-8{stroke:hsl(150, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-8{stroke-width:-10;}#mermaid-svg-cp8w3YyR1b0xejAO .section-8 line{stroke:hsl(330, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:black;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-9 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-9 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-9 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-9 path{fill:hsl(180, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-9 text{fill:black;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-9{font-size:40px;color:black;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-9{stroke:hsl(180, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-9{stroke-width:-13;}#mermaid-svg-cp8w3YyR1b0xejAO .section-9 line{stroke:hsl(0, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:black;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-10 rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-10 path,#mermaid-svg-cp8w3YyR1b0xejAO .section-10 circle,#mermaid-svg-cp8w3YyR1b0xejAO .section-10 path{fill:hsl(210, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-10 text{fill:black;}#mermaid-svg-cp8w3YyR1b0xejAO .node-icon-10{font-size:40px;color:black;}#mermaid-svg-cp8w3YyR1b0xejAO .section-edge-10{stroke:hsl(210, 100%, 76.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .edge-depth-10{stroke-width:-16;}#mermaid-svg-cp8w3YyR1b0xejAO .section-10 line{stroke:hsl(30, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-cp8w3YyR1b0xejAO .lineWrapper line{stroke:black;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled,#mermaid-svg-cp8w3YyR1b0xejAO .disabled circle,#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:lightgray;}#mermaid-svg-cp8w3YyR1b0xejAO .disabled text{fill:#efefef;}#mermaid-svg-cp8w3YyR1b0xejAO .section-root rect,#mermaid-svg-cp8w3YyR1b0xejAO .section-root path,#mermaid-svg-cp8w3YyR1b0xejAO .section-root circle{fill:hsl(240, 100%, 46.2745098039%);}#mermaid-svg-cp8w3YyR1b0xejAO .section-root text{fill:#ffffff;}#mermaid-svg-cp8w3YyR1b0xejAO .icon-container{height:100%;display:flex;justify-content:center;align-items:center;}#mermaid-svg-cp8w3YyR1b0xejAO .edge{fill:none;}#mermaid-svg-cp8w3YyR1b0xejAO .eventWrapper{filter:brightness(120%);}#mermaid-svg-cp8w3YyR1b0xejAO :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 2003 Yum 诞生 解决 RPM 依赖地狱 2012 DNF 实验性发布 Fedora 18 引入 2015 Fedora 22 默认使用DNF DNF 正式上位 2019 RHEL 8 抛弃 Yum yum 命令变成 dnf的软链接 2024 Yum 彻底成为历史 对新用户来说它只是一个传说 Yum → DNF 进化史
四、DNF 的内部构造(现代工业风)
DNF 并不是从零开始写的------它站在 Yum 的肩膀上,但把核心引擎整个换掉了。
#mermaid-svg-UhtvpETCHJeBiPUB{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-UhtvpETCHJeBiPUB .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-UhtvpETCHJeBiPUB .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-UhtvpETCHJeBiPUB .error-icon{fill:#552222;}#mermaid-svg-UhtvpETCHJeBiPUB .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-UhtvpETCHJeBiPUB .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-UhtvpETCHJeBiPUB .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-UhtvpETCHJeBiPUB .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-UhtvpETCHJeBiPUB .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-UhtvpETCHJeBiPUB .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-UhtvpETCHJeBiPUB .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-UhtvpETCHJeBiPUB .marker{fill:#333333;stroke:#333333;}#mermaid-svg-UhtvpETCHJeBiPUB .marker.cross{stroke:#333333;}#mermaid-svg-UhtvpETCHJeBiPUB svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-UhtvpETCHJeBiPUB p{margin:0;}#mermaid-svg-UhtvpETCHJeBiPUB .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-UhtvpETCHJeBiPUB .cluster-label text{fill:#333;}#mermaid-svg-UhtvpETCHJeBiPUB .cluster-label span{color:#333;}#mermaid-svg-UhtvpETCHJeBiPUB .cluster-label span p{background-color:transparent;}#mermaid-svg-UhtvpETCHJeBiPUB .label text,#mermaid-svg-UhtvpETCHJeBiPUB span{fill:#333;color:#333;}#mermaid-svg-UhtvpETCHJeBiPUB .node rect,#mermaid-svg-UhtvpETCHJeBiPUB .node circle,#mermaid-svg-UhtvpETCHJeBiPUB .node ellipse,#mermaid-svg-UhtvpETCHJeBiPUB .node polygon,#mermaid-svg-UhtvpETCHJeBiPUB .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-UhtvpETCHJeBiPUB .rough-node .label text,#mermaid-svg-UhtvpETCHJeBiPUB .node .label text,#mermaid-svg-UhtvpETCHJeBiPUB .image-shape .label,#mermaid-svg-UhtvpETCHJeBiPUB .icon-shape .label{text-anchor:middle;}#mermaid-svg-UhtvpETCHJeBiPUB .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-UhtvpETCHJeBiPUB .rough-node .label,#mermaid-svg-UhtvpETCHJeBiPUB .node .label,#mermaid-svg-UhtvpETCHJeBiPUB .image-shape .label,#mermaid-svg-UhtvpETCHJeBiPUB .icon-shape .label{text-align:center;}#mermaid-svg-UhtvpETCHJeBiPUB .node.clickable{cursor:pointer;}#mermaid-svg-UhtvpETCHJeBiPUB .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-UhtvpETCHJeBiPUB .arrowheadPath{fill:#333333;}#mermaid-svg-UhtvpETCHJeBiPUB .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-UhtvpETCHJeBiPUB .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-UhtvpETCHJeBiPUB .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-UhtvpETCHJeBiPUB .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-UhtvpETCHJeBiPUB .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-UhtvpETCHJeBiPUB .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-UhtvpETCHJeBiPUB .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-UhtvpETCHJeBiPUB .cluster text{fill:#333;}#mermaid-svg-UhtvpETCHJeBiPUB .cluster span{color:#333;}#mermaid-svg-UhtvpETCHJeBiPUB div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-UhtvpETCHJeBiPUB .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-UhtvpETCHJeBiPUB rect.text{fill:none;stroke-width:0;}#mermaid-svg-UhtvpETCHJeBiPUB .icon-shape,#mermaid-svg-UhtvpETCHJeBiPUB .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-UhtvpETCHJeBiPUB .icon-shape p,#mermaid-svg-UhtvpETCHJeBiPUB .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-UhtvpETCHJeBiPUB .icon-shape .label rect,#mermaid-svg-UhtvpETCHJeBiPUB .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-UhtvpETCHJeBiPUB .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-UhtvpETCHJeBiPUB .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-UhtvpETCHJeBiPUB :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 远程仓库
数据存储层
依赖求解器
DNF 核心引擎
前端API层
dnf / yum 命令
Python API
DNF Daemon
(后台守护进程)
Hawkey
(高效的查询库)
libdnf
(C++ 底层库)
Delta RPM
(增量更新支持)
libsolv
(SAT求解器, 速度飙升)
SQLite 数据库
替代 Yum 的 XML 缓存
RPM 本地数据库
BaseOS
AppStream
EPEL
Copr
DNF 把依赖求解换成了 libsolv(基于 SAT 算法),这就像把一辆老捷达的发动机换成了 F1 赛车的------外观还是那辆车,但一脚油门下去直接起飞。
五、Yum vs DNF:父子终极对决
#mermaid-svg-LgZmduFGmKzIkNiL{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-LgZmduFGmKzIkNiL .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-LgZmduFGmKzIkNiL .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-LgZmduFGmKzIkNiL .error-icon{fill:#552222;}#mermaid-svg-LgZmduFGmKzIkNiL .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-LgZmduFGmKzIkNiL .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-LgZmduFGmKzIkNiL .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-LgZmduFGmKzIkNiL .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-LgZmduFGmKzIkNiL .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-LgZmduFGmKzIkNiL .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-LgZmduFGmKzIkNiL .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-LgZmduFGmKzIkNiL .marker{fill:#333333;stroke:#333333;}#mermaid-svg-LgZmduFGmKzIkNiL .marker.cross{stroke:#333333;}#mermaid-svg-LgZmduFGmKzIkNiL svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-LgZmduFGmKzIkNiL p{margin:0;}#mermaid-svg-LgZmduFGmKzIkNiL .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-LgZmduFGmKzIkNiL .cluster-label text{fill:#333;}#mermaid-svg-LgZmduFGmKzIkNiL .cluster-label span{color:#333;}#mermaid-svg-LgZmduFGmKzIkNiL .cluster-label span p{background-color:transparent;}#mermaid-svg-LgZmduFGmKzIkNiL .label text,#mermaid-svg-LgZmduFGmKzIkNiL span{fill:#333;color:#333;}#mermaid-svg-LgZmduFGmKzIkNiL .node rect,#mermaid-svg-LgZmduFGmKzIkNiL .node circle,#mermaid-svg-LgZmduFGmKzIkNiL .node ellipse,#mermaid-svg-LgZmduFGmKzIkNiL .node polygon,#mermaid-svg-LgZmduFGmKzIkNiL .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-LgZmduFGmKzIkNiL .rough-node .label text,#mermaid-svg-LgZmduFGmKzIkNiL .node .label text,#mermaid-svg-LgZmduFGmKzIkNiL .image-shape .label,#mermaid-svg-LgZmduFGmKzIkNiL .icon-shape .label{text-anchor:middle;}#mermaid-svg-LgZmduFGmKzIkNiL .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-LgZmduFGmKzIkNiL .rough-node .label,#mermaid-svg-LgZmduFGmKzIkNiL .node .label,#mermaid-svg-LgZmduFGmKzIkNiL .image-shape .label,#mermaid-svg-LgZmduFGmKzIkNiL .icon-shape .label{text-align:center;}#mermaid-svg-LgZmduFGmKzIkNiL .node.clickable{cursor:pointer;}#mermaid-svg-LgZmduFGmKzIkNiL .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-LgZmduFGmKzIkNiL .arrowheadPath{fill:#333333;}#mermaid-svg-LgZmduFGmKzIkNiL .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-LgZmduFGmKzIkNiL .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-LgZmduFGmKzIkNiL .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-LgZmduFGmKzIkNiL .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-LgZmduFGmKzIkNiL .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-LgZmduFGmKzIkNiL .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-LgZmduFGmKzIkNiL .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-LgZmduFGmKzIkNiL .cluster text{fill:#333;}#mermaid-svg-LgZmduFGmKzIkNiL .cluster span{color:#333;}#mermaid-svg-LgZmduFGmKzIkNiL div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-LgZmduFGmKzIkNiL .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-LgZmduFGmKzIkNiL rect.text{fill:none;stroke-width:0;}#mermaid-svg-LgZmduFGmKzIkNiL .icon-shape,#mermaid-svg-LgZmduFGmKzIkNiL .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-LgZmduFGmKzIkNiL .icon-shape p,#mermaid-svg-LgZmduFGmKzIkNiL .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-LgZmduFGmKzIkNiL .icon-shape .label rect,#mermaid-svg-LgZmduFGmKzIkNiL .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-LgZmduFGmKzIkNiL .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-LgZmduFGmKzIkNiL .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-LgZmduFGmKzIkNiL :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 🚀 DNF (2012-至今)
🐢 Yum (2003-2019)
升级!
升级!
升级!
修复!
重写!
加功能!
Python 2 编写
XML 元数据存储
(文件多、加载慢)
自研 C 扩展
(依赖解析慢)
内存泄漏
(用久了就胀)
API 不友好
(二次开发头疼)
不支持增量更新
Python 3 + C++ 混合
SQLite 数据库
(加载飞快)
libsolv SAT 求解器
(毫秒级解析)
内存管理优化
(告别泄漏)
完善的 Python API
(二次开发友好)
支持 Delta RPM
(增量更新省流量)
六、DNF 的独门武功
1. Delta RPM ------ 只下载"差异"部分
传统 Yum 更新一个软件包,即使只改了一行代码,也得整个包重新下载一遍。DNF 的 Delta RPM 技术只下载新旧版本之间的差异,自动在本地合成新包。
#mermaid-svg-XJri2IxtSf4J9dL5{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-XJri2IxtSf4J9dL5 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-XJri2IxtSf4J9dL5 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-XJri2IxtSf4J9dL5 .error-icon{fill:#552222;}#mermaid-svg-XJri2IxtSf4J9dL5 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-XJri2IxtSf4J9dL5 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-XJri2IxtSf4J9dL5 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-XJri2IxtSf4J9dL5 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-XJri2IxtSf4J9dL5 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-XJri2IxtSf4J9dL5 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-XJri2IxtSf4J9dL5 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-XJri2IxtSf4J9dL5 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-XJri2IxtSf4J9dL5 .marker.cross{stroke:#333333;}#mermaid-svg-XJri2IxtSf4J9dL5 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-XJri2IxtSf4J9dL5 p{margin:0;}#mermaid-svg-XJri2IxtSf4J9dL5 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-XJri2IxtSf4J9dL5 .cluster-label text{fill:#333;}#mermaid-svg-XJri2IxtSf4J9dL5 .cluster-label span{color:#333;}#mermaid-svg-XJri2IxtSf4J9dL5 .cluster-label span p{background-color:transparent;}#mermaid-svg-XJri2IxtSf4J9dL5 .label text,#mermaid-svg-XJri2IxtSf4J9dL5 span{fill:#333;color:#333;}#mermaid-svg-XJri2IxtSf4J9dL5 .node rect,#mermaid-svg-XJri2IxtSf4J9dL5 .node circle,#mermaid-svg-XJri2IxtSf4J9dL5 .node ellipse,#mermaid-svg-XJri2IxtSf4J9dL5 .node polygon,#mermaid-svg-XJri2IxtSf4J9dL5 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-XJri2IxtSf4J9dL5 .rough-node .label text,#mermaid-svg-XJri2IxtSf4J9dL5 .node .label text,#mermaid-svg-XJri2IxtSf4J9dL5 .image-shape .label,#mermaid-svg-XJri2IxtSf4J9dL5 .icon-shape .label{text-anchor:middle;}#mermaid-svg-XJri2IxtSf4J9dL5 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-XJri2IxtSf4J9dL5 .rough-node .label,#mermaid-svg-XJri2IxtSf4J9dL5 .node .label,#mermaid-svg-XJri2IxtSf4J9dL5 .image-shape .label,#mermaid-svg-XJri2IxtSf4J9dL5 .icon-shape .label{text-align:center;}#mermaid-svg-XJri2IxtSf4J9dL5 .node.clickable{cursor:pointer;}#mermaid-svg-XJri2IxtSf4J9dL5 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-XJri2IxtSf4J9dL5 .arrowheadPath{fill:#333333;}#mermaid-svg-XJri2IxtSf4J9dL5 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-XJri2IxtSf4J9dL5 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-XJri2IxtSf4J9dL5 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-XJri2IxtSf4J9dL5 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-XJri2IxtSf4J9dL5 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-XJri2IxtSf4J9dL5 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-XJri2IxtSf4J9dL5 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-XJri2IxtSf4J9dL5 .cluster text{fill:#333;}#mermaid-svg-XJri2IxtSf4J9dL5 .cluster span{color:#333;}#mermaid-svg-XJri2IxtSf4J9dL5 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-XJri2IxtSf4J9dL5 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-XJri2IxtSf4J9dL5 rect.text{fill:none;stroke-width:0;}#mermaid-svg-XJri2IxtSf4J9dL5 .icon-shape,#mermaid-svg-XJri2IxtSf4J9dL5 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-XJri2IxtSf4J9dL5 .icon-shape p,#mermaid-svg-XJri2IxtSf4J9dL5 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-XJri2IxtSf4J9dL5 .icon-shape .label rect,#mermaid-svg-XJri2IxtSf4J9dL5 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-XJri2IxtSf4J9dL5 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-XJri2IxtSf4J9dL5 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-XJri2IxtSf4J9dL5 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 旧版本 v1.0
100MB
Delta 差异
只下载 5MB
合成新版本 v1.1
省流量?是的,DNF 帮你的服务器省下的带宽,够你再开一台云主机了。
2. 事务化操作
bash
# 回滚上一次操作(没错,DNF 有"后悔药")
dnf history undo last
# 查看操作历史
dnf history list
DNF 会记录每一次安装/卸载/更新操作,生成事务 ID。出问题了?一键回滚,比时光机还好使。
3. 模块化流(Modularity)
RHEL 8 / CentOS 8 引入的模块化概念,同一个软件可以有多个版本流,互不冲突。
#mermaid-svg-VgF6m4UdyVBt3Fb5{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .error-icon{fill:#552222;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .marker.cross{stroke:#333333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-VgF6m4UdyVBt3Fb5 p{margin:0;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .cluster-label text{fill:#333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .cluster-label span{color:#333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .cluster-label span p{background-color:transparent;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .label text,#mermaid-svg-VgF6m4UdyVBt3Fb5 span{fill:#333;color:#333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .node rect,#mermaid-svg-VgF6m4UdyVBt3Fb5 .node circle,#mermaid-svg-VgF6m4UdyVBt3Fb5 .node ellipse,#mermaid-svg-VgF6m4UdyVBt3Fb5 .node polygon,#mermaid-svg-VgF6m4UdyVBt3Fb5 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .rough-node .label text,#mermaid-svg-VgF6m4UdyVBt3Fb5 .node .label text,#mermaid-svg-VgF6m4UdyVBt3Fb5 .image-shape .label,#mermaid-svg-VgF6m4UdyVBt3Fb5 .icon-shape .label{text-anchor:middle;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .rough-node .label,#mermaid-svg-VgF6m4UdyVBt3Fb5 .node .label,#mermaid-svg-VgF6m4UdyVBt3Fb5 .image-shape .label,#mermaid-svg-VgF6m4UdyVBt3Fb5 .icon-shape .label{text-align:center;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .node.clickable{cursor:pointer;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .arrowheadPath{fill:#333333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-VgF6m4UdyVBt3Fb5 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-VgF6m4UdyVBt3Fb5 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-VgF6m4UdyVBt3Fb5 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .cluster text{fill:#333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .cluster span{color:#333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-VgF6m4UdyVBt3Fb5 rect.text{fill:none;stroke-width:0;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .icon-shape,#mermaid-svg-VgF6m4UdyVBt3Fb5 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .icon-shape p,#mermaid-svg-VgF6m4UdyVBt3Fb5 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .icon-shape .label rect,#mermaid-svg-VgF6m4UdyVBt3Fb5 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-VgF6m4UdyVBt3Fb5 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-VgF6m4UdyVBt3Fb5 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-VgF6m4UdyVBt3Fb5 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} Python 模块
Node.js 模块
Node.js 10 流
Node.js 12 流
Node.js 18 流
Python 2.7 流
Python 3.6 流
Python 3.9 流
应用程序A
需要 Node 14 + Python 3.9
应用程序B
需要 Node 10 + Python 2.7
模块化简直是运维福音------再也不用为了装不同版本的软件而打架了。
七、常用命令速查(附幽默翻译)
| 命令 | 正经翻译 | 接地气翻译 |
|---|---|---|
dnf search <关键字> |
搜索软件包 | "老王,咱仓库里有这玩意儿吗?" |
dnf install <包名> |
安装软件包 | "老板,这个!打包带走!" |
dnf remove <包名> |
卸载软件包 | "这软件不好使,退货!" |
dnf update |
更新所有软件包 | "全部给我换成最新款!" |
dnf upgrade |
升级系统(可过时包) | "大扫除,过时的都扔了!" |
dnf info <包名> |
查看软件包信息 | "把这东西的户口本调出来看看" |
dnf list installed |
列出已安装软件包 | "让我瞅瞅我都装了些啥" |
dnf repolist |
列出仓库 | "看看咱家有几家供应商" |
dnf history |
查看操作历史 | "翻翻小本本,刚才我都干啥了" |
dnf autoremove |
自动卸载孤儿依赖 | "当初为了你装的,现在你也走了,它们也该走了" |
dnf downgrade <包名> |
降级软件包 | "新版本太拉了,退回去!" |
八、yum 命令还能用吗?
在 RHEL 8 / CentOS 8 及之后的系统里,你敲 yum install xxx,系统仍然会乖乖执行------因为 /usr/bin/yum 本质上已经是 DNF 的软链接了:
bash
$ ls -l /usr/bin/yum
lrwxrwxrwx. 1 root root 5 /usr/bin/yum -> dnf-3
说白了,你喊的是"Yum",但来干活的是 DNF。这就像你妈喊你小名,但你已经是成年人了------名字没变,内核不一样了。
九、CentOS 7 能装 DNF 吗?------"老房子装新空调"
这是个灵魂拷问。CentOS 7 的原配是 Yum,但 DNF 是可以装上去的------前提是你别指望它"全面接管"。
#mermaid-svg-Vds72WdR3WLhEGl3{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Vds72WdR3WLhEGl3 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Vds72WdR3WLhEGl3 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Vds72WdR3WLhEGl3 .error-icon{fill:#552222;}#mermaid-svg-Vds72WdR3WLhEGl3 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Vds72WdR3WLhEGl3 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Vds72WdR3WLhEGl3 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Vds72WdR3WLhEGl3 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Vds72WdR3WLhEGl3 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Vds72WdR3WLhEGl3 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Vds72WdR3WLhEGl3 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Vds72WdR3WLhEGl3 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Vds72WdR3WLhEGl3 .marker.cross{stroke:#333333;}#mermaid-svg-Vds72WdR3WLhEGl3 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Vds72WdR3WLhEGl3 p{margin:0;}#mermaid-svg-Vds72WdR3WLhEGl3 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-Vds72WdR3WLhEGl3 .cluster-label text{fill:#333;}#mermaid-svg-Vds72WdR3WLhEGl3 .cluster-label span{color:#333;}#mermaid-svg-Vds72WdR3WLhEGl3 .cluster-label span p{background-color:transparent;}#mermaid-svg-Vds72WdR3WLhEGl3 .label text,#mermaid-svg-Vds72WdR3WLhEGl3 span{fill:#333;color:#333;}#mermaid-svg-Vds72WdR3WLhEGl3 .node rect,#mermaid-svg-Vds72WdR3WLhEGl3 .node circle,#mermaid-svg-Vds72WdR3WLhEGl3 .node ellipse,#mermaid-svg-Vds72WdR3WLhEGl3 .node polygon,#mermaid-svg-Vds72WdR3WLhEGl3 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Vds72WdR3WLhEGl3 .rough-node .label text,#mermaid-svg-Vds72WdR3WLhEGl3 .node .label text,#mermaid-svg-Vds72WdR3WLhEGl3 .image-shape .label,#mermaid-svg-Vds72WdR3WLhEGl3 .icon-shape .label{text-anchor:middle;}#mermaid-svg-Vds72WdR3WLhEGl3 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Vds72WdR3WLhEGl3 .rough-node .label,#mermaid-svg-Vds72WdR3WLhEGl3 .node .label,#mermaid-svg-Vds72WdR3WLhEGl3 .image-shape .label,#mermaid-svg-Vds72WdR3WLhEGl3 .icon-shape .label{text-align:center;}#mermaid-svg-Vds72WdR3WLhEGl3 .node.clickable{cursor:pointer;}#mermaid-svg-Vds72WdR3WLhEGl3 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Vds72WdR3WLhEGl3 .arrowheadPath{fill:#333333;}#mermaid-svg-Vds72WdR3WLhEGl3 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Vds72WdR3WLhEGl3 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Vds72WdR3WLhEGl3 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Vds72WdR3WLhEGl3 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Vds72WdR3WLhEGl3 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Vds72WdR3WLhEGl3 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Vds72WdR3WLhEGl3 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Vds72WdR3WLhEGl3 .cluster text{fill:#333;}#mermaid-svg-Vds72WdR3WLhEGl3 .cluster span{color:#333;}#mermaid-svg-Vds72WdR3WLhEGl3 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Vds72WdR3WLhEGl3 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Vds72WdR3WLhEGl3 rect.text{fill:none;stroke-width:0;}#mermaid-svg-Vds72WdR3WLhEGl3 .icon-shape,#mermaid-svg-Vds72WdR3WLhEGl3 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Vds72WdR3WLhEGl3 .icon-shape p,#mermaid-svg-Vds72WdR3WLhEGl3 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Vds72WdR3WLhEGl3 .icon-shape .label rect,#mermaid-svg-Vds72WdR3WLhEGl3 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Vds72WdR3WLhEGl3 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Vds72WdR3WLhEGl3 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Vds72WdR3WLhEGl3 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} EPEL 仓库
CentOS 7 系统
yum install dnf
安装后
安装结果
yum 和 dnf 共存
⚠️ 但功能受限
模块化 ❌
部分仓库兼容 ❌
基础的 install/search 可用 ✅
yum (原生)
Python 2 + RPM 4.x
dnf 安装包
(可由 yum 安装)
安装步骤
bash
# 1. 先装上 EPEL 仓库(CentOS 7 的扩展包来源)
yum install -y epel-release
# 2. 从 EPEL 安装 dnf
yum install -y dnf
# 3. 验证一下
dnf --version
能干啥?不能干啥?
| 功能 | CentOS 7 上的 DNF | 说明 |
|---|---|---|
search / install / remove |
✅ | 基本操作没问题 |
history |
✅ | 回滚也能用 |
repolist |
✅ | 查仓库正常 |
| 模块化 (module) | ❌ | CentOS 7 不支持模块化,DNA 缺陷 |
| AppStream | ❌ | 同上,需要系统级支持 |
| 自动替代 yum | ❌ | /usr/bin/yum 还是原版 yum,不会软链到 dnf |
总结:CentOS 7 装 DNF 就像给一台老式收音机装蓝牙------能响,但别幻想它能变成 Bose 音箱。日常用 yum 就够了,装 DNF 纯属尝鲜。到了 RHEL 8 / CentOS 8,DNF 才是正宫娘娘。
十、如何指定和配置仓库------"你的外卖菜单归谁管"
不管是 Yum 还是 DNF,它们都需要知道"去哪取货"。这个"取货地址"就是仓库 (Repository),配置文件都躺在 /etc/yum.repos.d/ 目录下,以 .repo 结尾。
#mermaid-svg-PUEL4l938xVtnt2x{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-PUEL4l938xVtnt2x .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-PUEL4l938xVtnt2x .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-PUEL4l938xVtnt2x .error-icon{fill:#552222;}#mermaid-svg-PUEL4l938xVtnt2x .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-PUEL4l938xVtnt2x .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-PUEL4l938xVtnt2x .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-PUEL4l938xVtnt2x .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-PUEL4l938xVtnt2x .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-PUEL4l938xVtnt2x .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-PUEL4l938xVtnt2x .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-PUEL4l938xVtnt2x .marker{fill:#333333;stroke:#333333;}#mermaid-svg-PUEL4l938xVtnt2x .marker.cross{stroke:#333333;}#mermaid-svg-PUEL4l938xVtnt2x svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-PUEL4l938xVtnt2x p{margin:0;}#mermaid-svg-PUEL4l938xVtnt2x .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-PUEL4l938xVtnt2x .cluster-label text{fill:#333;}#mermaid-svg-PUEL4l938xVtnt2x .cluster-label span{color:#333;}#mermaid-svg-PUEL4l938xVtnt2x .cluster-label span p{background-color:transparent;}#mermaid-svg-PUEL4l938xVtnt2x .label text,#mermaid-svg-PUEL4l938xVtnt2x span{fill:#333;color:#333;}#mermaid-svg-PUEL4l938xVtnt2x .node rect,#mermaid-svg-PUEL4l938xVtnt2x .node circle,#mermaid-svg-PUEL4l938xVtnt2x .node ellipse,#mermaid-svg-PUEL4l938xVtnt2x .node polygon,#mermaid-svg-PUEL4l938xVtnt2x .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-PUEL4l938xVtnt2x .rough-node .label text,#mermaid-svg-PUEL4l938xVtnt2x .node .label text,#mermaid-svg-PUEL4l938xVtnt2x .image-shape .label,#mermaid-svg-PUEL4l938xVtnt2x .icon-shape .label{text-anchor:middle;}#mermaid-svg-PUEL4l938xVtnt2x .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-PUEL4l938xVtnt2x .rough-node .label,#mermaid-svg-PUEL4l938xVtnt2x .node .label,#mermaid-svg-PUEL4l938xVtnt2x .image-shape .label,#mermaid-svg-PUEL4l938xVtnt2x .icon-shape .label{text-align:center;}#mermaid-svg-PUEL4l938xVtnt2x .node.clickable{cursor:pointer;}#mermaid-svg-PUEL4l938xVtnt2x .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-PUEL4l938xVtnt2x .arrowheadPath{fill:#333333;}#mermaid-svg-PUEL4l938xVtnt2x .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-PUEL4l938xVtnt2x .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-PUEL4l938xVtnt2x .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-PUEL4l938xVtnt2x .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-PUEL4l938xVtnt2x .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-PUEL4l938xVtnt2x .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-PUEL4l938xVtnt2x .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-PUEL4l938xVtnt2x .cluster text{fill:#333;}#mermaid-svg-PUEL4l938xVtnt2x .cluster span{color:#333;}#mermaid-svg-PUEL4l938xVtnt2x div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-PUEL4l938xVtnt2x .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-PUEL4l938xVtnt2x rect.text{fill:none;stroke-width:0;}#mermaid-svg-PUEL4l938xVtnt2x .icon-shape,#mermaid-svg-PUEL4l938xVtnt2x .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-PUEL4l938xVtnt2x .icon-shape p,#mermaid-svg-PUEL4l938xVtnt2x .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-PUEL4l938xVtnt2x .icon-shape .label rect,#mermaid-svg-PUEL4l938xVtnt2x .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-PUEL4l938xVtnt2x .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-PUEL4l938xVtnt2x .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-PUEL4l938xVtnt2x :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 一个.repo文件的结构
配置层
/etc/yum.repos.d/
存放 .repo 文件
CentOS-Base.repo
epel.repo
docker-ce.repo
自建的 local.repo
仓库ID ← 唯一标识,别重复
name=仓库描述
baseurl=仓库地址
enabled=1 ← 是否启用 (1=是, 0=否)
gpgcheck=1 ← 是否校验 GPG 签名
gpgkey=GPG密钥文件路径
priority=1 ← 优先级 (数字越小越优先)
一个完整的 .repo 文件长这样
ini
[my-custom-repo]
name=My Custom Repository - CentOS 7 Base
baseurl=http://mirrors.aliyun.com/centos/7/os/x86_64/
# 或者用本地路径: file:///mnt/cdrom
# 或者用 FTP: ftp://192.168.1.100/repo
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
priority=1
仓库地址 (baseurl) 的三种写法
| 协议 | 示例 | 场景 |
|---|---|---|
http:// |
http://mirrors.aliyun.com/centos/7/os/x86_64/ |
互联网/内网 远程仓库 |
file:// |
file:///mnt/iso |
本地挂载的光盘或目录 |
ftp:// |
ftp://192.168.1.100/pub/repo |
局域网 FTP 服务器 |
同一个仓库配多个镜像(mirrorlist)
ini
[base]
name=CentOS-$releasever - Base
# 用 mirrorlist 让系统自动选最快的镜像
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
# baseurl 可以作为备胎,当 mirrorlist 挂了时顶上
baseurl=http://vault.centos.org/centos/$releasever/os/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
$releasever和$basearch是 Yum/DNF 内置变量,自动替换成系统版本和架构(如7和x86_64),省得你手动改。
仓库优先级:防止"抢单"
当多个仓库都提供同一个软件包时,装哪个?这时候需要装 yum-plugin-priorities(或 DNF 内置的 priority)来定规矩:
bash
# CentOS 7 / Yum
yum install -y yum-plugin-priorities
# 然后在 .repo 文件里加一行
priority=1 # 数字越小越优先,范围 1-99
#mermaid-svg-J0a1ux9vgpTMxL6h{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-J0a1ux9vgpTMxL6h .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-J0a1ux9vgpTMxL6h .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-J0a1ux9vgpTMxL6h .error-icon{fill:#552222;}#mermaid-svg-J0a1ux9vgpTMxL6h .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-J0a1ux9vgpTMxL6h .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-J0a1ux9vgpTMxL6h .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-J0a1ux9vgpTMxL6h .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-J0a1ux9vgpTMxL6h .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-J0a1ux9vgpTMxL6h .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-J0a1ux9vgpTMxL6h .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-J0a1ux9vgpTMxL6h .marker{fill:#333333;stroke:#333333;}#mermaid-svg-J0a1ux9vgpTMxL6h .marker.cross{stroke:#333333;}#mermaid-svg-J0a1ux9vgpTMxL6h svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-J0a1ux9vgpTMxL6h p{margin:0;}#mermaid-svg-J0a1ux9vgpTMxL6h .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-J0a1ux9vgpTMxL6h .cluster-label text{fill:#333;}#mermaid-svg-J0a1ux9vgpTMxL6h .cluster-label span{color:#333;}#mermaid-svg-J0a1ux9vgpTMxL6h .cluster-label span p{background-color:transparent;}#mermaid-svg-J0a1ux9vgpTMxL6h .label text,#mermaid-svg-J0a1ux9vgpTMxL6h span{fill:#333;color:#333;}#mermaid-svg-J0a1ux9vgpTMxL6h .node rect,#mermaid-svg-J0a1ux9vgpTMxL6h .node circle,#mermaid-svg-J0a1ux9vgpTMxL6h .node ellipse,#mermaid-svg-J0a1ux9vgpTMxL6h .node polygon,#mermaid-svg-J0a1ux9vgpTMxL6h .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-J0a1ux9vgpTMxL6h .rough-node .label text,#mermaid-svg-J0a1ux9vgpTMxL6h .node .label text,#mermaid-svg-J0a1ux9vgpTMxL6h .image-shape .label,#mermaid-svg-J0a1ux9vgpTMxL6h .icon-shape .label{text-anchor:middle;}#mermaid-svg-J0a1ux9vgpTMxL6h .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-J0a1ux9vgpTMxL6h .rough-node .label,#mermaid-svg-J0a1ux9vgpTMxL6h .node .label,#mermaid-svg-J0a1ux9vgpTMxL6h .image-shape .label,#mermaid-svg-J0a1ux9vgpTMxL6h .icon-shape .label{text-align:center;}#mermaid-svg-J0a1ux9vgpTMxL6h .node.clickable{cursor:pointer;}#mermaid-svg-J0a1ux9vgpTMxL6h .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-J0a1ux9vgpTMxL6h .arrowheadPath{fill:#333333;}#mermaid-svg-J0a1ux9vgpTMxL6h .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-J0a1ux9vgpTMxL6h .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-J0a1ux9vgpTMxL6h .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-J0a1ux9vgpTMxL6h .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-J0a1ux9vgpTMxL6h .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-J0a1ux9vgpTMxL6h .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-J0a1ux9vgpTMxL6h .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-J0a1ux9vgpTMxL6h .cluster text{fill:#333;}#mermaid-svg-J0a1ux9vgpTMxL6h .cluster span{color:#333;}#mermaid-svg-J0a1ux9vgpTMxL6h div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-J0a1ux9vgpTMxL6h .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-J0a1ux9vgpTMxL6h rect.text{fill:none;stroke-width:0;}#mermaid-svg-J0a1ux9vgpTMxL6h .icon-shape,#mermaid-svg-J0a1ux9vgpTMxL6h .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-J0a1ux9vgpTMxL6h .icon-shape p,#mermaid-svg-J0a1ux9vgpTMxL6h .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-J0a1ux9vgpTMxL6h .icon-shape .label rect,#mermaid-svg-J0a1ux9vgpTMxL6h .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-J0a1ux9vgpTMxL6h .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-J0a1ux9vgpTMxL6h .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-J0a1ux9vgpTMxL6h :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 混乱,看谁先被找到
规则清晰
有优先级
priority=1 自建仓库 ✅ 胜出
priority=10 官方仓库
priority=20 EPEL
无优先级
EPEL 仓库
nginx v1.20
官方仓库
nginx v1.14
自建仓库
nginx v1.18
可能装到 1.14
也可能装到 1.20
全看运气 😅
必定装 1.18
自建仓库最优先
常用仓库管理命令
bash
# 列出所有仓库
yum repolist # 只看启用的
yum repolist all # 包括禁用的
# 临时禁用某个仓库
yum install --disablerepo=epel 软件包名
yum install --enablerepo=epel 软件包名 # 临时启用
# 查看仓库里有没有这个包
yum list available | grep nginx
# 清缓存(改完 repo 配置后必须执行)
yum clean all
yum makecache # 重建缓存
改完
.repo文件一定要yum clean all && yum makecache,不然 Yum/DNF 会抱着过期缓存死不松手,跟抱着前任照片不放一样倔。
十一、离线仓库搭建------"没网?咱自己开一家超市!"
生产环境很多服务器是纯内网、物理隔离 的,连不上互联网。这时候就得自己动手,丰衣足食------搭建本地离线仓库。
方案对比
#mermaid-svg-Rr5QzyI486Cg8IyF{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Rr5QzyI486Cg8IyF .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Rr5QzyI486Cg8IyF .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Rr5QzyI486Cg8IyF .error-icon{fill:#552222;}#mermaid-svg-Rr5QzyI486Cg8IyF .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Rr5QzyI486Cg8IyF .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Rr5QzyI486Cg8IyF .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Rr5QzyI486Cg8IyF .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Rr5QzyI486Cg8IyF .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Rr5QzyI486Cg8IyF .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Rr5QzyI486Cg8IyF .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Rr5QzyI486Cg8IyF .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Rr5QzyI486Cg8IyF .marker.cross{stroke:#333333;}#mermaid-svg-Rr5QzyI486Cg8IyF svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Rr5QzyI486Cg8IyF p{margin:0;}#mermaid-svg-Rr5QzyI486Cg8IyF .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-Rr5QzyI486Cg8IyF .cluster-label text{fill:#333;}#mermaid-svg-Rr5QzyI486Cg8IyF .cluster-label span{color:#333;}#mermaid-svg-Rr5QzyI486Cg8IyF .cluster-label span p{background-color:transparent;}#mermaid-svg-Rr5QzyI486Cg8IyF .label text,#mermaid-svg-Rr5QzyI486Cg8IyF span{fill:#333;color:#333;}#mermaid-svg-Rr5QzyI486Cg8IyF .node rect,#mermaid-svg-Rr5QzyI486Cg8IyF .node circle,#mermaid-svg-Rr5QzyI486Cg8IyF .node ellipse,#mermaid-svg-Rr5QzyI486Cg8IyF .node polygon,#mermaid-svg-Rr5QzyI486Cg8IyF .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Rr5QzyI486Cg8IyF .rough-node .label text,#mermaid-svg-Rr5QzyI486Cg8IyF .node .label text,#mermaid-svg-Rr5QzyI486Cg8IyF .image-shape .label,#mermaid-svg-Rr5QzyI486Cg8IyF .icon-shape .label{text-anchor:middle;}#mermaid-svg-Rr5QzyI486Cg8IyF .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Rr5QzyI486Cg8IyF .rough-node .label,#mermaid-svg-Rr5QzyI486Cg8IyF .node .label,#mermaid-svg-Rr5QzyI486Cg8IyF .image-shape .label,#mermaid-svg-Rr5QzyI486Cg8IyF .icon-shape .label{text-align:center;}#mermaid-svg-Rr5QzyI486Cg8IyF .node.clickable{cursor:pointer;}#mermaid-svg-Rr5QzyI486Cg8IyF .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Rr5QzyI486Cg8IyF .arrowheadPath{fill:#333333;}#mermaid-svg-Rr5QzyI486Cg8IyF .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Rr5QzyI486Cg8IyF .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Rr5QzyI486Cg8IyF .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Rr5QzyI486Cg8IyF .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Rr5QzyI486Cg8IyF .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Rr5QzyI486Cg8IyF .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Rr5QzyI486Cg8IyF .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Rr5QzyI486Cg8IyF .cluster text{fill:#333;}#mermaid-svg-Rr5QzyI486Cg8IyF .cluster span{color:#333;}#mermaid-svg-Rr5QzyI486Cg8IyF div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Rr5QzyI486Cg8IyF .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Rr5QzyI486Cg8IyF rect.text{fill:none;stroke-width:0;}#mermaid-svg-Rr5QzyI486Cg8IyF .icon-shape,#mermaid-svg-Rr5QzyI486Cg8IyF .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Rr5QzyI486Cg8IyF .icon-shape p,#mermaid-svg-Rr5QzyI486Cg8IyF .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Rr5QzyI486Cg8IyF .icon-shape .label rect,#mermaid-svg-Rr5QzyI486Cg8IyF .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Rr5QzyI486Cg8IyF .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Rr5QzyI486Cg8IyF .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Rr5QzyI486Cg8IyF :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 方案选择
有
没有
方案B:ISO 当仓库
- 挂载 CentOS ISO 镜像
- 直接写 .repo 指向挂载点
- 开箱即用 ✅
方案A:rsync 同步远程仓库 - 在一台能上网的机器上
rsync 同步整个仓库目录
2. 拷贝到内网服务器
3. 用 createrepo 重建索引
4. 通过 HTTP / FTP 或本地目录发布
你有互联网出口机器吗?
方案A:联网机同步 → 拷贝到内网
方案B:直接拿 ISO/DVD 当仓库
方案 A:全量同步远程仓库(适合内网多台机器共用)
第一步:在有网络的机器上同步仓库
bash
# 以 CentOS 7 为例,同步阿里云镜像站
# 这一步会下载几十 GB,请找个大硬盘、快网速的机器
# 同步 Base 仓库
rsync -avz --delete \
rsync://mirrors.aliyun.com/centos/7/os/x86_64/ \
/data/repo/centos/7/os/x86_64/
# 同步 Updates 仓库
rsync -avz --delete \
rsync://mirrors.aliyun.com/centos/7/updates/x86_64/ \
/data/repo/centos/7/updates/x86_64/
# 同步 EPEL 仓库
rsync -avz --delete \
rsync://mirrors.aliyun.com/epel/7/x86_64/ \
/data/repo/epel/7/x86_64/
--delete参数会让目标目录和源目录一模一样,源删了目标也删。不想删的话去掉它。注意:这个参数不是"删除本地文件",而是"删除目标端不再存在于源端的文件"。
第二步:拷贝到内网服务器
bash
# 打好压缩包
tar -zcvf centos7-repo.tar.gz /data/repo/
# 通过 U盘 / 移动硬盘 / scp 等方式拷到内网服务器
# scp 示例(如果内网机器能从这台机器上去):
scp -r /data/repo/ root@192.168.1.100:/data/repo/
第三步:安装 createrepo 并重建索引
bash
# 安装 createrepo 工具
yum install -y createrepo
# 为每个仓库目录生成 repodata 元数据
createrepo /data/repo/centos/7/os/x86_64/
createrepo /data/repo/centos/7/updates/x86_64/
createrepo /data/repo/epel/7/x86_64/
# 如果有新包加入,用 --update 增量更新(比全量重建快很多)
createrepo --update /data/repo/centos/7/os/x86_64/
#mermaid-svg-RubOyodKTkhKQOI6{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-RubOyodKTkhKQOI6 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-RubOyodKTkhKQOI6 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-RubOyodKTkhKQOI6 .error-icon{fill:#552222;}#mermaid-svg-RubOyodKTkhKQOI6 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-RubOyodKTkhKQOI6 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-RubOyodKTkhKQOI6 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-RubOyodKTkhKQOI6 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-RubOyodKTkhKQOI6 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-RubOyodKTkhKQOI6 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-RubOyodKTkhKQOI6 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-RubOyodKTkhKQOI6 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-RubOyodKTkhKQOI6 .marker.cross{stroke:#333333;}#mermaid-svg-RubOyodKTkhKQOI6 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-RubOyodKTkhKQOI6 p{margin:0;}#mermaid-svg-RubOyodKTkhKQOI6 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-RubOyodKTkhKQOI6 .cluster-label text{fill:#333;}#mermaid-svg-RubOyodKTkhKQOI6 .cluster-label span{color:#333;}#mermaid-svg-RubOyodKTkhKQOI6 .cluster-label span p{background-color:transparent;}#mermaid-svg-RubOyodKTkhKQOI6 .label text,#mermaid-svg-RubOyodKTkhKQOI6 span{fill:#333;color:#333;}#mermaid-svg-RubOyodKTkhKQOI6 .node rect,#mermaid-svg-RubOyodKTkhKQOI6 .node circle,#mermaid-svg-RubOyodKTkhKQOI6 .node ellipse,#mermaid-svg-RubOyodKTkhKQOI6 .node polygon,#mermaid-svg-RubOyodKTkhKQOI6 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-RubOyodKTkhKQOI6 .rough-node .label text,#mermaid-svg-RubOyodKTkhKQOI6 .node .label text,#mermaid-svg-RubOyodKTkhKQOI6 .image-shape .label,#mermaid-svg-RubOyodKTkhKQOI6 .icon-shape .label{text-anchor:middle;}#mermaid-svg-RubOyodKTkhKQOI6 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-RubOyodKTkhKQOI6 .rough-node .label,#mermaid-svg-RubOyodKTkhKQOI6 .node .label,#mermaid-svg-RubOyodKTkhKQOI6 .image-shape .label,#mermaid-svg-RubOyodKTkhKQOI6 .icon-shape .label{text-align:center;}#mermaid-svg-RubOyodKTkhKQOI6 .node.clickable{cursor:pointer;}#mermaid-svg-RubOyodKTkhKQOI6 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-RubOyodKTkhKQOI6 .arrowheadPath{fill:#333333;}#mermaid-svg-RubOyodKTkhKQOI6 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-RubOyodKTkhKQOI6 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-RubOyodKTkhKQOI6 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-RubOyodKTkhKQOI6 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-RubOyodKTkhKQOI6 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-RubOyodKTkhKQOI6 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-RubOyodKTkhKQOI6 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-RubOyodKTkhKQOI6 .cluster text{fill:#333;}#mermaid-svg-RubOyodKTkhKQOI6 .cluster span{color:#333;}#mermaid-svg-RubOyodKTkhKQOI6 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-RubOyodKTkhKQOI6 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-RubOyodKTkhKQOI6 rect.text{fill:none;stroke-width:0;}#mermaid-svg-RubOyodKTkhKQOI6 .icon-shape,#mermaid-svg-RubOyodKTkhKQOI6 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-RubOyodKTkhKQOI6 .icon-shape p,#mermaid-svg-RubOyodKTkhKQOI6 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-RubOyodKTkhKQOI6 .icon-shape .label rect,#mermaid-svg-RubOyodKTkhKQOI6 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-RubOyodKTkhKQOI6 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-RubOyodKTkhKQOI6 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-RubOyodKTkhKQOI6 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} createrepo
一堆 RPM 文件
kernel-3.10.rpm
nginx-1.20.rpm
openssl-1.0.rpm
...成百上千个
repodata/
├─ filelists.xml.gz
├─ primary.xml.gz
├─ other.xml.gz
└─ repomd.xml
(Yum/DNF 靠这些索引找人)
仓库目录
createrepo的作用就是把一堆散装的 RPM 文件归档成"超市货架"------Yum/DNF 来了之后先翻货架目录(repodata),找到东西在哪,再精准拿取。
第四步:提供访问方式
方式 1:本地目录(最简单)
ini
# /etc/yum.repos.d/local.repo
[local-base]
name=Local CentOS 7 Base
baseurl=file:///data/repo/centos/7/os/x86_64/
enabled=1
gpgcheck=0 # 自己搭的仓库一般关掉签名校验
[local-updates]
name=Local CentOS 7 Updates
baseurl=file:///data/repo/centos/7/updates/x86_64/
enabled=1
gpgcheck=0
[local-epel]
name=Local EPEL
baseurl=file:///data/repo/epel/7/x86_64/
enabled=1
gpgcheck=0
缺点:只能本机用。适合单机场景。
方式 2:HTTP 服务(局域网共享,推荐)
bash
# 装个 nginx 或 httpd
yum install -y nginx
# 配置 nginx,指向仓库目录
cat > /etc/nginx/conf.d/repo.conf << 'EOF'
server {
listen 80;
server_name 192.168.1.100; # 替换成你的内网 IP
location /repo/ {
alias /data/repo/;
autoindex on; # 允许列目录
autoindex_exact_size off;
autoindex_localtime on;
}
}
EOF
# 启动 nginx
systemctl start nginx
systemctl enable nginx
# 别忘了防火墙放行 80 端口
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --reload
然后其他内网机器的 .repo 文件这样写:
ini
[local-http-base]
name=Local CentOS 7 Base via HTTP
baseurl=http://192.168.1.100/repo/centos/7/os/x86_64/
enabled=1
gpgcheck=0
#mermaid-svg-P8XLiw7m3ICZcFsb{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-P8XLiw7m3ICZcFsb .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-P8XLiw7m3ICZcFsb .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-P8XLiw7m3ICZcFsb .error-icon{fill:#552222;}#mermaid-svg-P8XLiw7m3ICZcFsb .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-P8XLiw7m3ICZcFsb .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-P8XLiw7m3ICZcFsb .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-P8XLiw7m3ICZcFsb .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-P8XLiw7m3ICZcFsb .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-P8XLiw7m3ICZcFsb .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-P8XLiw7m3ICZcFsb .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-P8XLiw7m3ICZcFsb .marker{fill:#333333;stroke:#333333;}#mermaid-svg-P8XLiw7m3ICZcFsb .marker.cross{stroke:#333333;}#mermaid-svg-P8XLiw7m3ICZcFsb svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-P8XLiw7m3ICZcFsb p{margin:0;}#mermaid-svg-P8XLiw7m3ICZcFsb .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-P8XLiw7m3ICZcFsb .cluster-label text{fill:#333;}#mermaid-svg-P8XLiw7m3ICZcFsb .cluster-label span{color:#333;}#mermaid-svg-P8XLiw7m3ICZcFsb .cluster-label span p{background-color:transparent;}#mermaid-svg-P8XLiw7m3ICZcFsb .label text,#mermaid-svg-P8XLiw7m3ICZcFsb span{fill:#333;color:#333;}#mermaid-svg-P8XLiw7m3ICZcFsb .node rect,#mermaid-svg-P8XLiw7m3ICZcFsb .node circle,#mermaid-svg-P8XLiw7m3ICZcFsb .node ellipse,#mermaid-svg-P8XLiw7m3ICZcFsb .node polygon,#mermaid-svg-P8XLiw7m3ICZcFsb .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-P8XLiw7m3ICZcFsb .rough-node .label text,#mermaid-svg-P8XLiw7m3ICZcFsb .node .label text,#mermaid-svg-P8XLiw7m3ICZcFsb .image-shape .label,#mermaid-svg-P8XLiw7m3ICZcFsb .icon-shape .label{text-anchor:middle;}#mermaid-svg-P8XLiw7m3ICZcFsb .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-P8XLiw7m3ICZcFsb .rough-node .label,#mermaid-svg-P8XLiw7m3ICZcFsb .node .label,#mermaid-svg-P8XLiw7m3ICZcFsb .image-shape .label,#mermaid-svg-P8XLiw7m3ICZcFsb .icon-shape .label{text-align:center;}#mermaid-svg-P8XLiw7m3ICZcFsb .node.clickable{cursor:pointer;}#mermaid-svg-P8XLiw7m3ICZcFsb .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-P8XLiw7m3ICZcFsb .arrowheadPath{fill:#333333;}#mermaid-svg-P8XLiw7m3ICZcFsb .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-P8XLiw7m3ICZcFsb .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-P8XLiw7m3ICZcFsb .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-P8XLiw7m3ICZcFsb .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-P8XLiw7m3ICZcFsb .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-P8XLiw7m3ICZcFsb .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-P8XLiw7m3ICZcFsb .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-P8XLiw7m3ICZcFsb .cluster text{fill:#333;}#mermaid-svg-P8XLiw7m3ICZcFsb .cluster span{color:#333;}#mermaid-svg-P8XLiw7m3ICZcFsb div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-P8XLiw7m3ICZcFsb .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-P8XLiw7m3ICZcFsb rect.text{fill:none;stroke-width:0;}#mermaid-svg-P8XLiw7m3ICZcFsb .icon-shape,#mermaid-svg-P8XLiw7m3ICZcFsb .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-P8XLiw7m3ICZcFsb .icon-shape p,#mermaid-svg-P8XLiw7m3ICZcFsb .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-P8XLiw7m3ICZcFsb .icon-shape .label rect,#mermaid-svg-P8XLiw7m3ICZcFsb .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-P8XLiw7m3ICZcFsb .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-P8XLiw7m3ICZcFsb .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-P8XLiw7m3ICZcFsb :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 内网
HTTP 分发
HTTP 分发
HTTP 分发
HTTP 分发
仓库服务器
192.168.1.100
nginx 提供 HTTP 服务
客户端A
192.168.1.10
客户端B
192.168.1.11
客户端C
192.168.1.12
......
最多几百台都行
方案 B:直接用 ISO 镜像当仓库(适合临时或装机场景)
这是最简单粗暴的方式------CentOS 的安装 ISO 本身就自带完整的 Base 仓库。
bash
# 1. 挂载 ISO(假设 ISO 在 /root/CentOS-7-x86_64-DVD-2009.iso)
mkdir -p /mnt/cdrom
mount -o loop /root/CentOS-7-x86_64-DVD-2009.iso /mnt/cdrom
# 2. 写 repo 文件
cat > /etc/yum.repos.d/local-iso.repo << 'EOF'
[local-iso-base]
name=Local ISO - CentOS 7 Base
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
EOF
# 3. 禁用其他仓库,防止干扰
yum --disablerepo="*" --enablerepo="local-iso-base" install 你想要的包
# 4. 用完卸载
umount /mnt/cdrom
设置开机自动挂载 ISO:
bash
echo "/root/CentOS-7-x86_64-DVD-2009.iso /mnt/cdrom iso9660 loop,defaults 0 0" >> /etc/fstab
ISO 方案就像"带上泡面去无人区"------虽然种类少(只有 Base 仓库),但能保命。EPEL 什么的就别想了,除非你把 EPEL 也同步下来。
完整离线仓库架构总图
#mermaid-svg-ODVOSfHXibDFWgRp{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-ODVOSfHXibDFWgRp .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-ODVOSfHXibDFWgRp .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-ODVOSfHXibDFWgRp .error-icon{fill:#552222;}#mermaid-svg-ODVOSfHXibDFWgRp .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-ODVOSfHXibDFWgRp .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-ODVOSfHXibDFWgRp .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-ODVOSfHXibDFWgRp .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-ODVOSfHXibDFWgRp .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-ODVOSfHXibDFWgRp .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-ODVOSfHXibDFWgRp .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-ODVOSfHXibDFWgRp .marker{fill:#333333;stroke:#333333;}#mermaid-svg-ODVOSfHXibDFWgRp .marker.cross{stroke:#333333;}#mermaid-svg-ODVOSfHXibDFWgRp svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-ODVOSfHXibDFWgRp p{margin:0;}#mermaid-svg-ODVOSfHXibDFWgRp .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-ODVOSfHXibDFWgRp .cluster-label text{fill:#333;}#mermaid-svg-ODVOSfHXibDFWgRp .cluster-label span{color:#333;}#mermaid-svg-ODVOSfHXibDFWgRp .cluster-label span p{background-color:transparent;}#mermaid-svg-ODVOSfHXibDFWgRp .label text,#mermaid-svg-ODVOSfHXibDFWgRp span{fill:#333;color:#333;}#mermaid-svg-ODVOSfHXibDFWgRp .node rect,#mermaid-svg-ODVOSfHXibDFWgRp .node circle,#mermaid-svg-ODVOSfHXibDFWgRp .node ellipse,#mermaid-svg-ODVOSfHXibDFWgRp .node polygon,#mermaid-svg-ODVOSfHXibDFWgRp .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-ODVOSfHXibDFWgRp .rough-node .label text,#mermaid-svg-ODVOSfHXibDFWgRp .node .label text,#mermaid-svg-ODVOSfHXibDFWgRp .image-shape .label,#mermaid-svg-ODVOSfHXibDFWgRp .icon-shape .label{text-anchor:middle;}#mermaid-svg-ODVOSfHXibDFWgRp .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-ODVOSfHXibDFWgRp .rough-node .label,#mermaid-svg-ODVOSfHXibDFWgRp .node .label,#mermaid-svg-ODVOSfHXibDFWgRp .image-shape .label,#mermaid-svg-ODVOSfHXibDFWgRp .icon-shape .label{text-align:center;}#mermaid-svg-ODVOSfHXibDFWgRp .node.clickable{cursor:pointer;}#mermaid-svg-ODVOSfHXibDFWgRp .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-ODVOSfHXibDFWgRp .arrowheadPath{fill:#333333;}#mermaid-svg-ODVOSfHXibDFWgRp .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-ODVOSfHXibDFWgRp .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-ODVOSfHXibDFWgRp .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-ODVOSfHXibDFWgRp .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-ODVOSfHXibDFWgRp .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-ODVOSfHXibDFWgRp .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-ODVOSfHXibDFWgRp .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-ODVOSfHXibDFWgRp .cluster text{fill:#333;}#mermaid-svg-ODVOSfHXibDFWgRp .cluster span{color:#333;}#mermaid-svg-ODVOSfHXibDFWgRp div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-ODVOSfHXibDFWgRp .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-ODVOSfHXibDFWgRp rect.text{fill:none;stroke-width:0;}#mermaid-svg-ODVOSfHXibDFWgRp .icon-shape,#mermaid-svg-ODVOSfHXibDFWgRp .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-ODVOSfHXibDFWgRp .icon-shape p,#mermaid-svg-ODVOSfHXibDFWgRp .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-ODVOSfHXibDFWgRp .icon-shape .label rect,#mermaid-svg-ODVOSfHXibDFWgRp .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-ODVOSfHXibDFWgRp .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-ODVOSfHXibDFWgRp .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-ODVOSfHXibDFWgRp :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 内网环境
外网中转机
分发方式
rsync
物理拷贝
yum/dnf install
yum/dnf install
yum/dnf install
☁️ 互联网镜像站
mirrors.163.com
rsync 同步
createrepo 建索引
数据存储
/data/repo/
U盘/硬盘拷贝
(物理摆渡)
HTTP 服务器
nginx / httpd
🎯 推荐:局域网批量分发
本地目录
file:// 直接读
📌 适合单机
FTP 服务器
vsftpd
📌 有些老系统喜欢
🐔 内网客户端机器群
192.168.1.0/24
离线仓库的精髓就一句话:"仓库的本质就是一堆 RPM 文件 + 一个目录索引"。 你只要把 RPM 文件拷过去,再用
createrepo生成索引,Yum/DNF 就会认它。至于用 HTTP、FTP 还是本地目录,只是"配送方式"不同罢了。
十二、总结
#mermaid-svg-LxsDazQK4DO5HZsM{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-LxsDazQK4DO5HZsM .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-LxsDazQK4DO5HZsM .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-LxsDazQK4DO5HZsM .error-icon{fill:#552222;}#mermaid-svg-LxsDazQK4DO5HZsM .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-LxsDazQK4DO5HZsM .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-LxsDazQK4DO5HZsM .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-LxsDazQK4DO5HZsM .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-LxsDazQK4DO5HZsM .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-LxsDazQK4DO5HZsM .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-LxsDazQK4DO5HZsM .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-LxsDazQK4DO5HZsM .marker{fill:#333333;stroke:#333333;}#mermaid-svg-LxsDazQK4DO5HZsM .marker.cross{stroke:#333333;}#mermaid-svg-LxsDazQK4DO5HZsM svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-LxsDazQK4DO5HZsM p{margin:0;}#mermaid-svg-LxsDazQK4DO5HZsM .edge{stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .section--1 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section--1 path,#mermaid-svg-LxsDazQK4DO5HZsM .section--1 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section--1 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section--1 path{fill:hsl(240, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section--1 text{fill:#ffffff;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon--1{font-size:40px;color:#ffffff;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge--1{stroke:hsl(240, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth--1{stroke-width:17;}#mermaid-svg-LxsDazQK4DO5HZsM .section--1 line{stroke:hsl(60, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-0 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-0 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-0 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-0 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-0 path{fill:hsl(60, 100%, 73.5294117647%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-0 text{fill:black;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-0{font-size:40px;color:black;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-0{stroke:hsl(60, 100%, 73.5294117647%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-0{stroke-width:14;}#mermaid-svg-LxsDazQK4DO5HZsM .section-0 line{stroke:hsl(240, 100%, 83.5294117647%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-1 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-1 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-1 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-1 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-1 path{fill:hsl(80, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-1 text{fill:black;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-1{font-size:40px;color:black;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-1{stroke:hsl(80, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-1{stroke-width:11;}#mermaid-svg-LxsDazQK4DO5HZsM .section-1 line{stroke:hsl(260, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-2 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-2 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-2 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-2 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-2 path{fill:hsl(270, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-2 text{fill:#ffffff;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-2{font-size:40px;color:#ffffff;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-2{stroke:hsl(270, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-2{stroke-width:8;}#mermaid-svg-LxsDazQK4DO5HZsM .section-2 line{stroke:hsl(90, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-3 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-3 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-3 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-3 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-3 path{fill:hsl(300, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-3 text{fill:black;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-3{font-size:40px;color:black;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-3{stroke:hsl(300, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-3{stroke-width:5;}#mermaid-svg-LxsDazQK4DO5HZsM .section-3 line{stroke:hsl(120, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-4 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-4 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-4 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-4 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-4 path{fill:hsl(330, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-4 text{fill:black;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-4{font-size:40px;color:black;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-4{stroke:hsl(330, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-4{stroke-width:2;}#mermaid-svg-LxsDazQK4DO5HZsM .section-4 line{stroke:hsl(150, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-5 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-5 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-5 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-5 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-5 path{fill:hsl(0, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-5 text{fill:black;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-5{font-size:40px;color:black;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-5{stroke:hsl(0, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-5{stroke-width:-1;}#mermaid-svg-LxsDazQK4DO5HZsM .section-5 line{stroke:hsl(180, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-6 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-6 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-6 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-6 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-6 path{fill:hsl(30, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-6 text{fill:black;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-6{font-size:40px;color:black;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-6{stroke:hsl(30, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-6{stroke-width:-4;}#mermaid-svg-LxsDazQK4DO5HZsM .section-6 line{stroke:hsl(210, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-7 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-7 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-7 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-7 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-7 path{fill:hsl(90, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-7 text{fill:black;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-7{font-size:40px;color:black;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-7{stroke:hsl(90, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-7{stroke-width:-7;}#mermaid-svg-LxsDazQK4DO5HZsM .section-7 line{stroke:hsl(270, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-8 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-8 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-8 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-8 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-8 path{fill:hsl(150, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-8 text{fill:black;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-8{font-size:40px;color:black;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-8{stroke:hsl(150, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-8{stroke-width:-10;}#mermaid-svg-LxsDazQK4DO5HZsM .section-8 line{stroke:hsl(330, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-9 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-9 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-9 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-9 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-9 path{fill:hsl(180, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-9 text{fill:black;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-9{font-size:40px;color:black;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-9{stroke:hsl(180, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-9{stroke-width:-13;}#mermaid-svg-LxsDazQK4DO5HZsM .section-9 line{stroke:hsl(0, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-10 rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-10 path,#mermaid-svg-LxsDazQK4DO5HZsM .section-10 circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-10 polygon,#mermaid-svg-LxsDazQK4DO5HZsM .section-10 path{fill:hsl(210, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-10 text{fill:black;}#mermaid-svg-LxsDazQK4DO5HZsM .node-icon-10{font-size:40px;color:black;}#mermaid-svg-LxsDazQK4DO5HZsM .section-edge-10{stroke:hsl(210, 100%, 76.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .edge-depth-10{stroke-width:-16;}#mermaid-svg-LxsDazQK4DO5HZsM .section-10 line{stroke:hsl(30, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled,#mermaid-svg-LxsDazQK4DO5HZsM .disabled circle,#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:lightgray;}#mermaid-svg-LxsDazQK4DO5HZsM .disabled text{fill:#efefef;}#mermaid-svg-LxsDazQK4DO5HZsM .section-root rect,#mermaid-svg-LxsDazQK4DO5HZsM .section-root path,#mermaid-svg-LxsDazQK4DO5HZsM .section-root circle,#mermaid-svg-LxsDazQK4DO5HZsM .section-root polygon{fill:hsl(240, 100%, 46.2745098039%);}#mermaid-svg-LxsDazQK4DO5HZsM .section-root text{fill:#ffffff;}#mermaid-svg-LxsDazQK4DO5HZsM .section-root span{color:#ffffff;}#mermaid-svg-LxsDazQK4DO5HZsM .section-2 span{color:#ffffff;}#mermaid-svg-LxsDazQK4DO5HZsM .icon-container{height:100%;display:flex;justify-content:center;align-items:center;}#mermaid-svg-LxsDazQK4DO5HZsM .edge{fill:none;}#mermaid-svg-LxsDazQK4DO5HZsM .mindmap-node-label{dy:1em;alignment-baseline:middle;text-anchor:middle;dominant-baseline:middle;text-align:center;}#mermaid-svg-LxsDazQK4DO5HZsM :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} Linux 包管理
Debian/Ubuntu 系
dpkg
apt / apt-get
Red Hat/Fedora 系
RPM 底层
上层包管理器
Yum 已退役
Python 2
依赖解析慢
成为历史
DNF 新一代
libsolv SAT求解
SQLite 缓存
增量更新
模块化支持
事务回滚
SUSE 系
zypper
Arch 系
pacman
Yum 陪伴了无数运维人的青春,它是那个时代最好的解决方案。而 DNF 接过了接力棒,带着更强的引擎、更优雅的设计继续前进。
如果你还在用 Yum,是时候说一声:
"谢谢你,Yum。接下来,交给 DNF 吧。" 🫡
------ 一个曾经在凌晨三点被 Yum 依赖地狱折磨过的运维人,含泪写于某个终于不用加班的日子