更新源可以获取最新的软件信息,以更新您的系统
YUM(Yellow dog Updater Modified): yum是Redhat系列系统基于RPM包构建的软件更新机制,可以自动解决 rpm 包之间的依赖关系,所有软件包由集中的yum软件仓库提供。其理念是使用一个中心仓库(repository)管理一部分甚至一个distribution的应用程序相互关系,根据计算出来的软件依赖关系进行相关的升级、安装、 删除等操作,减少了Linux用户一直头痛的dependencies的问题。可以同时配置多个资源库(Repository),简洁的配置文件(/etc/yum.conf),自动解决增加或删除rpm包时遇到的依赖性问题,保持与RPM数据库的一致性。
yum的配置文件在 /etc/yum.repos.d/ 下面,必须以 .repo 结尾!
配置本地yum源
配置本地yum源是通过本地映射光盘挂载到系统中,然后将yum的配置文件中的 baseurl 指向挂载的目录即可。
首先在虚拟机的这个配置中,勾选使用iso映射文件,然后选中我们iso文件所在的位置即可。
在虚拟机系统中,我们的 iso 文件是 /dev/sr0 设备,系统会默认把我们的iso文件挂载到 /run/media/\(username/ 目录下。但是现在我们要将iso文件挂载到 /mnt/cdrom 下。如果mnt目录下没有cdrom,那么我们自己新建一个。</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLLwxufysiar4NUeHr3wJ64anloXeFdd2eKbwcLhib2maIyjcFoFMDh7bw/640?wx_fmt=png" class="rich_pages wxw-img" data-ratio="0." data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLLwxufysiar4NUeHr3wJ64anloXeFdd2eKbwcLhib2maIyjcFoFMDh7bw/640?wx_fmt=png" data-type="png" data-w="1080" height="112" style="outline: none;border-width: 0px;border-style: initial;border-color: initial;cursor: zoom-in;" width="600" /></p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">挂载有两种方式挂载</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">一: 一次性挂载,重启完系统后失效</p><pre data-index="0" name="code" style="outline: 0px;margin-bottom: 24px;padding: 8px;white-space: pre-wrap;overflow: auto hidden;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 14px;line-height: 22px;color: rgb(0, 0, 0);max-height: unset;letter-spacing: normal;text-align: start;background-color: rgb(255, 255, 255);"><code style="white-space:pre-wrap;outline: 0px;display: block;overflow-x: auto;padding: 8px;color: rgb(56, 58, 66);background: rgb(250, 250, 250);border-radius: 4px;font-family: "Source Code Pro", "DejaVu Sans Mono", "Ubuntu Mono", "Anonymous Pro", "Droid Sans Mono", Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, "PingFang SC", "Microsoft YaHei", sans-serif;line-height: 22px;tab-size: 4;">mount <span style="outline: 0px;">/</span>dev<span style="outline: 0px;">/</span>sr<span style="outline: 0px;color: rgb(152, 104, 1);">0</span> <span style="outline: 0px;">/</span>mnt<span style="outline: 0px;">/</span>cdrom<br /></code></pre><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLCgYnNiccdueDcRjBTUATqfNT5jeia15ytp4Fltg4OLU8UQ4yEoibk4Q7g/640?wx_fmt=png" class="rich_pages wxw-img" data-ratio="0.82989" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLCgYnNiccdueDcRjBTUATqfNT5jeia15ytp4Fltg4OLU8UQ4yEoibk4Q7g/640?wx_fmt=png" data-type="png" data-w="823" height="188" style="outline: none;border-width: 0px;border-style: initial;border-color: initial;cursor: zoom-in;" width="600" /></p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">二:永久挂载</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">我们的设备的挂载信息在 /etc/fstab 里面,所以我们要想永久挂载,需要修改 fstab 文件。用 vim 打开该文件,我们可以看到有三行信息,是其他分区的挂载信息,所以我们现在要把我们的光盘的挂载信息添加过去。</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLKib4hfX1SRAPgEtjG0wCAawsUibTOH10FLtYVIUSltwAz2wQ9ExFUZcg/640?wx_fmt=png" class="rich_pages wxw-img" data-ratio="0." data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLKib4hfX1SRAPgEtjG0wCAawsUibTOH10FLtYVIUSltwAz2wQ9ExFUZcg/640?wx_fmt=png" data-type="png" data-w="1072" height="134" style="outline: none;border-width: 0px;border-style: initial;border-color: initial;cursor: zoom-in;" width="600" /></p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">添加如下我们光盘的挂载信息过去</p><pre data-index="1" name="code" style="outline: 0px;margin-bottom: 24px;padding: 8px;white-space: pre-wrap;overflow: auto hidden;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 14px;line-height: 22px;color: rgb(0, 0, 0);max-height: unset;letter-spacing: normal;text-align: start;background-color: rgb(255, 255, 255);"><code style="white-space:pre-wrap;outline: 0px;display: block;overflow-x: auto;padding: 8px;color: rgb(56, 58, 66);background: rgb(250, 250, 250);border-radius: 4px;font-family: "Source Code Pro", "DejaVu Sans Mono", "Ubuntu Mono", "Anonymous Pro", "Droid Sans Mono", Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, "PingFang SC", "Microsoft YaHei", sans-serif;line-height: 22px;tab-size: 4;"><span style="outline: 0px;">/</span>dev<span style="outline: 0px;">/</span>sr<span style="outline: 0px;color: rgb(152, 104, 1);">0</span> <span style="outline: 0px;">/</span>mnt<span style="outline: 0px;">/</span>cdrom iso<span style="outline: 0px;color: rgb(152, 104, 1);">9660</span> defaults <span style="outline: 0px;color: rgb(152, 104, 1);">0</span> <span style="outline: 0px;color: rgb(152, 104, 1);">0</span><br /></code></pre><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLTxpZk07iaLOXVhfibjzwSttJhQFtCibBLZBjZWSFvd097009nRfiaSbicsA/640?wx_fmt=png" class="rich_pages wxw-img" data-ratio="0." data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLTxpZk07iaLOXVhfibjzwSttJhQFtCibBLZBjZWSFvd097009nRfiaSbicsA/640?wx_fmt=png" data-type="png" data-w="1080" height="186" style="outline: none;border-width: 0px;border-style: initial;border-color: initial;cursor: zoom-in;" width="600" /></p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">添加完后,保存退出。</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">然后执行 mount -a 。这个命令的意思是挂载fstab文件中的所有文件系统。可以看到,我们已经挂载好了。</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLYxcneJ3vHTTxyN3zBmtbicKKicV19iblkmHu0KKPsZanaEZrBgK001XSw/640?wx_fmt=png" class="rich_pages wxw-img" data-ratio="0.4" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLYxcneJ3vHTTxyN3zBmtbicKKicV19iblkmHu0KKPsZanaEZrBgK001XSw/640?wx_fmt=png" data-type="png" data-w="1080" height="280" style="outline: none;border-width: 0px;border-style: initial;border-color: initial;cursor: zoom-in;" width="700" /></p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">挂载好iso文件之后,我们去修改源的配置文件 /etc/yum.repos.d/ ,它默认有一个文件,我们把它删除,然后自己新建以 .repo 结尾的文件,用vim编辑器打开。输入以下的配置,保存。</p><pre data-index="2" name="code" style="outline: 0px;margin-bottom: 24px;padding: 8px;white-space: pre-wrap;overflow: auto hidden;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 14px;line-height: 22px;color: rgb(0, 0, 0);max-height: unset;letter-spacing: normal;text-align: start;background-color: rgb(255, 255, 255);"><code style="white-space:pre-wrap;outline: 0px;display: block;overflow-x: auto;padding: 8px;color: rgb(56, 58, 66);background: rgb(250, 250, 250);border-radius: 4px;font-family: "Source Code Pro", "DejaVu Sans Mono", "Ubuntu Mono", "Anonymous Pro", "Droid Sans Mono", Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, "PingFang SC", "Microsoft YaHei", sans-serif;line-height: 22px;tab-size: 4;"><ol class="list-paddingleft-1" style="outline: 0px;list-style: none;border-collapse: collapse;font-size: 16px;overflow: hidden;width: 820px;"><li style="outline: 0px;list-style: none;height: 22px;"><p>[name] #括号中的名称为仓库源名称,通常为字母和数字,必须填写</p></li><li style="outline: 0px;list-style: none;height: 22px;"><p>name<span style="outline: 0px;">=</span>my new repo #对yum的描述,可写可不写</p></li><li style="outline: 0px;list-style: none;height: 22px;"><p>baseurl<span style="outline: 0px;">=</span><span style="outline: 0px;color: rgb(166, 38, 164);">file</span>:<span style="outline: 0px;">/</span><span style="outline: 0px;">/</span><span style="outline: 0px;">/</span>mnt<span style="outline: 0px;">/</span>cdrom #baseurl表示声明yum可以管理并使用的rpm包路径,必须填写</p></li><li style="outline: 0px;list-style: none;height: 22px;"><p>enabled<span style="outline: 0px;">=</span><span style="outline: 0px;color: rgb(152, 104, 1);">1</span> #enabled表示当前仓库是否开启,<span style="outline: 0px;color: rgb(152, 104, 1);">1</span>为开启,<span style="outline: 0px;color: rgb(152, 104, 1);">0</span>为关闭,此项不写默认为开启</p></li><li style="outline: 0px;list-style: none;height: 22px;"><p>gpgcheck<span style="outline: 0px;">=</span><span style="outline: 0px;color: rgb(152, 104, 1);">0</span> #gpgcheck表示安装rpm包时,是否基于公私钥对匹配包的安全信息,<span style="outline: 0px;color: rgb(152, 104, 1);">1</span>表示开启,</p></li><li style="outline: 0px;list-style: none;height: 22px;"><p>#<span style="outline: 0px;color: rgb(152, 104, 1);">0</span>表示关闭,此项不写默认为验证</p></li></ol></code></pre><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">然后执行 yum clean all ,清空缓存信息。 </p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">yum list | wc -l 统计列出所有包的数量,如果列出了,说明yum源配置完成。这里可以看出有4405个包。</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLyGj5YCef4ZXGrmED0ZbZkvv6icBjFk3cDiaqjYzWLuKOLSSecKQ9J6UA/640?wx_fmt=png" class="rich_pages wxw-img" data-ratio="0.37037" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLyGj5YCef4ZXGrmED0ZbZkvv6icBjFk3cDiaqjYzWLuKOLSSecKQ9J6UA/640?wx_fmt=png" data-type="png" data-w="1080" height="90" style="outline: none;border-width: 0px;border-style: initial;border-color: initial;cursor: zoom-in;" width="700" /></p><h4 style="outline: 0px;margin-top: 24px;margin-bottom: 8px;font-weight: 600;font-family: "PingFang SC", "Microsoft YaHei", SimHei, Arial, SimSun;font-size: 18px;color: rgb(79, 79, 79);line-height: 26px;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);">配置网络yum源</h4><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">由于Red Hat Enterprise Linux7的更新包只对注册的用户生效,所以需要自己手动改成Centos的更新包,Centos几乎和和Redhat是一样的,所以无需担心软件包的兼容问题。</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">首先查看redhat7系统本身安装的yum软件包 ,redhat本身安装了6个关于yum的软件包,我们需要把它给卸载!</p><pre data-index="3" name="code" style="outline: 0px;margin-bottom: 24px;padding: 8px;white-space: pre-wrap;overflow: auto hidden;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 14px;line-height: 22px;color: rgb(0, 0, 0);max-height: unset;letter-spacing: normal;text-align: start;background-color: rgb(255, 255, 255);"><code style="white-space:pre-wrap;outline: 0px;display: block;overflow-x: auto;padding: 8px;color: rgb(56, 58, 66);background: rgb(250, 250, 250);border-radius: 4px;font-family: "Source Code Pro", "DejaVu Sans Mono", "Ubuntu Mono", "Anonymous Pro", "Droid Sans Mono", Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, "PingFang SC", "Microsoft YaHei", sans-serif;line-height: 22px;tab-size: 4;">rpm -qa | <span style="outline: 0px;color: rgb(166, 38, 164);">grep</span> yum</code></pre><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLG8reY00iaMo26aYDvqS0yNWnWibbiaG7qPWqPtpmXAGibaOoqAAWmLnUwA/640?wx_fmt=png" data-ratio="0.12134" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLG8reY00iaMo26aYDvqS0yNWnWibbiaG7qPWqPtpmXAGibaOoqAAWmLnUwA/640?wx_fmt=png" data-type="png" data-w="478" height="119" style="outline: none;border-width: 0px;border-style: initial;border-color: initial;cursor: zoom-in;" width="350" /></p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">卸载这些软件包的指令 </p><pre data-index="4" name="code" style="outline: 0px;margin-bottom: 24px;padding: 8px;white-space: pre-wrap;overflow: auto hidden;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 14px;line-height: 22px;color: rgb(0, 0, 0);max-height: unset;letter-spacing: normal;text-align: start;background-color: rgb(255, 255, 255);"><code style="white-space:pre-wrap;outline: 0px;display: block;overflow-x: auto;padding: 8px;color: rgb(56, 58, 66);background: rgb(250, 250, 250);border-radius: 4px;font-family: "Source Code Pro", "DejaVu Sans Mono", "Ubuntu Mono", "Anonymous Pro", "Droid Sans Mono", Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, "PingFang SC", "Microsoft YaHei", sans-serif;line-height: 22px;tab-size: 4;">rpm -qa | <span style="outline: 0px;color: rgb(166, 38, 164);">grep</span> yum | xargs rpm -e --nodeps <span style="outline: 0px;color: rgb(160, 161, 167);font-style: italic;">#不检查依赖关系,直接卸载</span><br /></code></pre><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLEZnCAVqyNuBSr4Xta4C0V9Q7taJdFTgUjKwkqr6LIrLqC7s94IScRg/640?wx_fmt=png" class="rich_pages wxw-img" data-ratio="0.25926" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypLEZnCAVqyNuBSr4Xta4C0V9Q7taJdFTgUjKwkqr6LIrLqC7s94IScRg/640?wx_fmt=png" data-type="png" data-w="675" height="177" style="outline: none;border-width: 0px;border-style: initial;border-color: initial;cursor: zoom-in;" width="450" /></p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">然后重新安装centos的yum软件包 ,把软件包放到统一的文件夹里,然后安装,安装完后可以看到centos安装包已经安装好。这里我看其他很多人的教程给的centos的yum的安装包的链接都是不可用了,后来我自己到国外的网站找了几个可用的安装包。</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">链接: https://pan.baidu.com/s/10IrBjM5j_TJT0Qc2aW64Cg 提取码: i4pe</p><pre data-index="5" name="code" style="outline: 0px;margin-bottom: 24px;padding: 8px;white-space: pre-wrap;overflow: auto hidden;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 14px;line-height: 22px;color: rgb(0, 0, 0);max-height: unset;letter-spacing: normal;text-align: start;background-color: rgb(255, 255, 255);"><code style="white-space:pre-wrap;outline: 0px;display: block;overflow-x: auto;padding: 8px;color: rgb(56, 58, 66);background: rgb(250, 250, 250);border-radius: 4px;font-family: "Source Code Pro", "DejaVu Sans Mono", "Ubuntu Mono", "Anonymous Pro", "Droid Sans Mono", Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, "PingFang SC", "Microsoft YaHei", sans-serif;line-height: 22px;tab-size: 4;"><ol class="list-paddingleft-1" style="outline: 0px;list-style: none;border-collapse: collapse;font-size: 16px;overflow: hidden;width: 820px;"><li style="outline: 0px;list-style: none;height: 22px;"><p>rpm -ivh * <span style="outline: 0px;color: rgb(160, 161, 167);font-style: italic;"># 安装该目录下所有rpm包</span></p></li><li style="outline: 0px;list-style: none;height: 22px;"><p>rpm -qa | <span style="outline: 0px;color: rgb(166, 38, 164);">grep</span> yum <span style="outline: 0px;color: rgb(160, 161, 167);font-style: italic;"># 查询是否安装好</span></p></li></ol></code></pre><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypL10CuKPZicpa1aVIl3v9u6licBy1rtkg6JS0aljjV6bFTUfcQ5M2axmlw/640?wx_fmt=png" class="rich_pages wxw-img" data-ratio="0.62963" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/U2cKy2PXbatstE8xUCKHFCMtOGCib0ypL10CuKPZicpa1aVIl3v9u6licBy1rtkg6JS0aljjV6bFTUfcQ5M2axmlw/640?wx_fmt=png" data-type="png" data-w="1080" height="209" style="outline: none;border-width: 0px;border-style: initial;border-color: initial;cursor: zoom-in;" width="650" /></p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif, SimHei, SimSun;letter-spacing: normal;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 24px !important;">安装完centos的yum软件包后,就可以去修改 /etc/yum.repos.d/ 下的文件了,这里和配置本地yum源修改一样</p><pre data-index="6" name="code" style="outline: 0px;margin-bottom: 24px;padding: 8px;white-space: pre-wrap;overflow: auto hidden;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 14px;line-height: 22px;color: rgb(0, 0, 0);max-height: unset;letter-spacing: normal;text-align: start;background-color: rgb(255, 255, 255);"><code style="white-space:pre-wrap;outline: 0px;display: block;overflow-x: auto;padding: 8px;color: rgb(56, 58, 66);background: rgb(250, 250, 250);border-radius: 4px;font-family: "Source Code Pro", "DejaVu Sans Mono", "Ubuntu Mono", "Anonymous Pro", "Droid Sans Mono", Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, "PingFang SC", "Microsoft YaHei", sans-serif;line-height: 22px;tab-size: 4;"><ol class="list-paddingleft-1" style="outline: 0px;list-style: none;border-collapse: collapse;font-size: 16px;overflow: hidden;width: 820px;"><li style="outline: 0px;list-style: none;height: 22px;"><p>[base]</p></li><li style="outline: 0px;list-style: none;height: 22px;"><p>name<span style="outline: 0px;">=</span> yum repo</p></li><li style="outline: 0px;list-style: none;height: 22px;"><p>baseurl<span style="outline: 0px;">=</span>http:<span style="outline: 0px;">/</span><span style="outline: 0px;">/</span>mirrors.aliyun.com<span style="outline: 0px;">/</span>centos<span style="outline: 0px;">/</span><span style="outline: 0px;color: rgb(152, 104, 1);">7</span><span style="outline: 0px;">/</span>os<span style="outline: 0px;">/</span>\)basearch/

配置完保存退出,清除yum缓存,查看yum中的包有多少,这里可以看到有11056个,比本地yum源的四千多个多了不少!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/177470.html