CentOS国内YUM源及配置
<p style="box-sizing: border-box; font-size: 20px"><span style="font-size: 18px">1、阿里巴巴开源镜像站</span></p><div class="cnblogs_code">
<pre>Page:https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">opsx.alibaba.com/mirror</span>
<span style="color: rgba(0, 0, 0, 1)">
使用说明
a. 备份配置文件:
</span><span style="color: rgba(0, 0, 255, 1)">mv</span> /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-Base.repo /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-<span style="color: rgba(0, 0, 0, 1)">Base.repo.backup
b. 下载新的CentOS</span>-Base.repo 到/etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/<span style="color: rgba(0, 0, 0, 1)">
CentOS6:</span><span style="color: rgba(0, 0, 255, 1)">wget</span> -O /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-Base.repo http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.aliyun.com/repo/Centos-6.repo</span>
CentOS7:<span style="color: rgba(0, 0, 255, 1)">wget</span> -O /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-Base.repo http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.aliyun.com/repo/Centos-7.repo</span></pre>
</div>
<p><span style="font-size: 18px">2、网易开源镜像站点</span></p>
<div class="cnblogs_code">
<pre>Page:http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/.help/</span>
<span style="color: rgba(0, 0, 0, 1)">
使用说明
a. 首先备份</span>/etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-<span style="color: rgba(0, 0, 0, 1)">Base.repo
</span><span style="color: rgba(0, 0, 255, 1)">mv</span> /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-Base.repo /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-<span style="color: rgba(0, 0, 0, 1)">Base.repo.backup
b. 下载对应版本repo文件, 放入</span>/etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/<span style="color: rgba(0, 0, 0, 1)">(操作前请做好相应备份)
CentOS6:</span><span style="color: rgba(0, 0, 255, 1)">wget</span> -O /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-Base.repo http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/.help/CentOS6-Base-163.repo</span>
CentOS7:<span style="color: rgba(0, 0, 255, 1)">wget</span> -O /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-Base.repo http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/.help/CentOS7-Base-163.repo</span></pre>
</div>
<p style="box-sizing: border-box; font-size: 20px">3、华为开源镜像站点</p>
<div class="cnblogs_code">
<pre>Page:https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.huaweicloud.com/</span>
<span style="color: rgba(0, 0, 0, 1)">
使用说明
CentOS的镜像地址为:https:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.huaweicloud.com/centos/</span>
<span style="color: rgba(0, 0, 0, 1)">a. 备份配置文件:
</span><span style="color: rgba(0, 0, 255, 1)">cp</span> -a /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-Base.repo /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-<span style="color: rgba(0, 0, 0, 1)">Base.repo.bak
b. 修改CentOS</span>-Base.repo文件,取消baseurl开头的行的注释,并增加mirrorlist开头的行的注释。将文件中的http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirror.centos.org替换成https:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.huaweicloud.com,可以参考如下命令:</span>
<span style="color: rgba(0, 0, 255, 1)">sed</span> -i <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">s/#baseurl/baseurl/g</span><span style="color: rgba(128, 0, 0, 1)">"</span> /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-<span style="color: rgba(0, 0, 0, 1)">Base.repo
</span><span style="color: rgba(0, 0, 255, 1)">sed</span> -i <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">s/mirrorlist=http/#mirrorlist=http/g</span><span style="color: rgba(128, 0, 0, 1)">"</span> /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-<span style="color: rgba(0, 0, 0, 1)">Base.repo
</span><span style="color: rgba(0, 0, 255, 1)">sed</span> -i <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">s@http://mirror.centos.org@https://mirrors.huaweicloud.com@g</span><span style="color: rgba(128, 0, 0, 1)">"</span> /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-Base.repo</pre>
</div>
<p style="box-sizing: border-box; font-size: 20px">4、搜狐开源镜像站</p>
<div class="cnblogs_code">
<pre>Page:http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.sohu.com/</span>
<span style="color: rgba(0, 0, 0, 1)">
使用说明
CentOS的镜像地址为:http:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.sohu.com/centos/</span>
<span style="color: rgba(0, 0, 0, 1)">a. 备份配置文件:
</span><span style="color: rgba(0, 0, 255, 1)">cp</span> -a /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-Base.repo /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-<span style="color: rgba(0, 0, 0, 1)">Base.repo.bak
b. 修改CentOS</span>-Base.repo文件,取消baseurl开头的行的注释,并增加mirrorlist开头的行的注释。将文件中的http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirror.centos.org替换成http:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.sohu.com,可以参考如下命令:</span>
<span style="color: rgba(0, 0, 255, 1)">sed</span> -i <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">s/#baseurl/baseurl/g</span><span style="color: rgba(128, 0, 0, 1)">"</span> /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-<span style="color: rgba(0, 0, 0, 1)">Base.repo
</span><span style="color: rgba(0, 0, 255, 1)">sed</span> -i <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">s/mirrorlist=http/#mirrorlist=http/g</span><span style="color: rgba(128, 0, 0, 1)">"</span> /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-<span style="color: rgba(0, 0, 0, 1)">Base.repo
</span><span style="color: rgba(0, 0, 255, 1)">sed</span> -i <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">s@http://mirror.centos.org@http://mirrors.sohu.com@g</span><span style="color: rgba(128, 0, 0, 1)">"</span> /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-Base.repo</pre>
</div>
<p> <span style="font-size: 18px">5、RHEL使用CentOS镜像站点</span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">※ 免责声明:业务系统慎用!
a. 删除RedHat自带的yum源
查看:rpm </span>-qa | <span style="color: rgba(0, 0, 255, 1)">grep</span> ^<span style="color: rgba(0, 0, 255, 1)">yum</span><span style="color: rgba(0, 0, 0, 1)">
删除:rpm </span>-qa | <span style="color: rgba(0, 0, 255, 1)">grep</span> <span style="color: rgba(0, 0, 255, 1)">yum</span> | <span style="color: rgba(0, 0, 255, 1)">xargs</span> rpm -e --<span style="color: rgba(0, 0, 0, 1)">nodeps
b. 下载CentOS镜像的yum包
</span><span style="color: rgba(0, 0, 255, 1)">wget</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm</span>
<span style="color: rgba(0, 0, 255, 1)">wget</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/centos/7/os/x86_64/Packages/yum-rhn-plugin-2.0.1-10.el7.noarch.rpm</span>
<span style="color: rgba(0, 0, 255, 1)">wget</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm</span>
<span style="color: rgba(0, 0, 255, 1)">wget</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm</span>
c. 安装yum包提示“rpm >= <span style="color: rgba(128, 0, 128, 1)">0</span>:<span style="color: rgba(128, 0, 128, 1)">4.11</span>.<span style="color: rgba(128, 0, 128, 1)">3</span>-<span style="color: rgba(128, 0, 128, 1)">22</span> is needed by <span style="color: rgba(0, 0, 255, 1)">yum</span>-<span style="color: rgba(128, 0, 128, 1)">3.4</span>.<span style="color: rgba(128, 0, 128, 1)">3</span>-<span style="color: rgba(128, 0, 128, 1)">158</span><span style="color: rgba(0, 0, 0, 1)">.el7.centos.noarch”
rpm </span>-qa | <span style="color: rgba(0, 0, 255, 1)">grep</span> ^<span style="color: rgba(0, 0, 0, 1)">rpm
</span><span style="color: rgba(0, 0, 255, 1)">wget</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm</span>
<span style="color: rgba(0, 0, 255, 1)">wget</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/centos/7/os/x86_64/Packages/rpm-libs-4.11.3-32.el7.x86_64.rpm</span>
<span style="color: rgba(0, 0, 255, 1)">wget</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/centos/7/os/x86_64/Packages/rpm-python-4.11.3-32.el7.x86_64.rpm</span>
<span style="color: rgba(0, 0, 255, 1)">wget</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">mirrors.163.com/centos/7/os/x86_64/Packages/rpm-build-libs-4.11.3-32.el7.x86_64.rpm</span>
rpm -Uvh rpm-*<span style="color: rgba(0, 0, 0, 1)">.rpm
d. 安装CentOS镜像的yum包
rpm </span>-ivh <span style="color: rgba(0, 0, 255, 1)">yum</span>-*<span style="color: rgba(0, 0, 0, 1)">.rpm
e. 替换.repo文件中的$releasever版本为7
</span><span style="color: rgba(0, 0, 255, 1)">sed</span> -i <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">s/\$releasever/7/g</span><span style="color: rgba(128, 0, 0, 1)">"</span> /etc/<span style="color: rgba(0, 0, 255, 1)">yum</span>.repos.d/CentOS-<span style="color: rgba(0, 0, 0, 1)">Base.repo
f. 安装EPEL源
</span><span style="color: rgba(0, 0, 255, 1)">yum</span> <span style="color: rgba(0, 0, 255, 1)">install</span> epel-<span style="color: rgba(0, 0, 0, 1)">release
g. 检查yum源可用性
</span><span style="color: rgba(0, 0, 255, 1)">yum</span> repolist && <span style="color: rgba(0, 0, 255, 1)">yum</span><span style="color: rgba(0, 0, 0, 1)"> list all
h. </span><span style="color: rgba(0, 0, 255, 1)">yum</span> update提示“Error: initscripts conflicts with redhat-release-<span style="color: rgba(0, 0, 0, 1)">server”
</span><span style="color: rgba(0, 0, 255, 1)">yum</span> check-update && <span style="color: rgba(0, 0, 255, 1)">yum</span> update --skip-<span style="color: rgba(0, 0, 0, 1)">broken
吐槽:在RHEL </span><span style="color: rgba(128, 0, 128, 1)">7</span>.3系统上仅执行e,g,h步骤可以使用yum update,重装与不重装yum包都会提示“This system is not registered to Red Hat Subscription Management.”(CentOS <span style="color: rgba(128, 0, 128, 1)">7.5</span> YUM源),可以跳过a,b,c,d步骤。</pre>
</div>
<p><span style="font-size: 18px">6、重建本地YUM缓存</span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 255, 1)">yum</span> clean all && <span style="color: rgba(0, 0, 255, 1)">yum</span> makecache</pre>
</div>
<p><span style="font-size: 16px">7、CentOS mirror status</span></p>
<p>http://mirror-status.centos.org/</p>
<p> 从镜像状态统计来看,“华为开源镜像站、搜狐开源镜像站”实时更新良好。</p>
<p> </p>
<div class="cnblogs_code">
<pre><span style="color: rgba(128, 0, 128, 1)">1</span><span style="color: rgba(0, 0, 0, 1)">\. 企业贡献:
搜狐开源镜像站:(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirrors.sohu.com/</span><span style="color: rgba(0, 128, 0, 1)">)</span>
<span style="color: rgba(0, 0, 0, 1)">
网易开源镜像站:(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirrors.163.com/</span><span style="color: rgba(0, 128, 0, 1)">)</span>
<span style="color: rgba(128, 0, 128, 1)">2</span><span style="color: rgba(0, 0, 0, 1)">\. 大学教学:
北京理工大学:
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirror.bit.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv4 only)</span>
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirror.bit6.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv6 only)</span>
<span style="color: rgba(0, 0, 0, 1)">
北京交通大学:
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirror.bjtu.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv4 only)</span>
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirror6.bjtu.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv6 only)</span>
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://debian.bjtu.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv4+IPv6)</span>
<span style="color: rgba(0, 0, 0, 1)">
兰州大学:(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirror.lzu.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">)</span>
<span style="color: rgba(0, 0, 0, 1)">
厦门大学:(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirrors.xmu.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">)</span>
<span style="color: rgba(0, 0, 0, 1)">
清华大学:
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirrors.tuna.tsinghua.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv4+IPv6)</span>
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirrors.6.tuna.tsinghua.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv6 only)</span>
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirrors.4.tuna.tsinghua.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv4 only)</span>
<span style="color: rgba(0, 0, 0, 1)">
天津大学:(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirror.tju.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">)</span>
<span style="color: rgba(0, 0, 0, 1)">
中国科学技术大学:
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirrors.ustc.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv4+IPv6)</span>
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirrors4.ustc.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">)</span>
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirrors6.ustc.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">)</span>
<span style="color: rgba(0, 0, 0, 1)">
东北大学:
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirror.neu.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv4 only)</span>
(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://mirror.neu6.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">) (IPv6 only)</span>
<span style="color: rgba(0, 0, 0, 1)">
电子科技大学:(</span><span style="color: rgba(0, 128, 0, 1); text-decoration: underline">http://ubuntu.uestc.edu.cn/</span><span style="color: rgba(0, 128, 0, 1)">)</span></pre>
</div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<ol style="box-sizing: border-box; margin-top: 0; margin-right: 0; margin-bottom: 20px; list-style-position: inside; list-style-image: initial; padding: 0; color: rgba(64, 64, 64, 1); font-family: Roboto, sans-serif"><ol style="box-sizing: border-box; margin-top: 0; margin-right: 0; margin-bottom: 20px; list-style-position: inside; list-style-image: initial; padding: 0; color: rgba(64, 64, 64, 1); font-family: Roboto, sans-serif">
<li style="box-sizing: border-box; font-size: 20px">
<h2 id="article_nav_0" style="box-sizing: border-box; font-family: "Merriweather Sans", sans-serif; line-height: 50px; color: inherit; margin-bottom: 20px; font-size: 20px; clear: both; display: inline; margin-top: 0 !important"> </h2>
</li>
</ol></ol><br><br>
来源:https://www.cnblogs.com/liujunjun/p/12260273.html
頁:
[1]