如何添加yum源和修改默认源、对系统yum源进行扩展
1 .首先进行下载yum repolist
yum repolist
2.修改默认源配置
base: mirror.lzu.edu.cn * extras: mirrors.sohu.com * updates: mirrors.sohu.com
修改成
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
修改成aliyun 下载速度会提高
修改步骤 :1.登录https://opsx.alibaba.com/mirror
2.进去页面选择centos 6.9(看自己版本) 点击帮助 根据提示先备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
3.下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
<code style="box-sizing: border-box; display: inline; font-family: monospace,monospace; font-size: 14px; line-height: 21px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left; vertical-align: baseline;">wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo</code>
或者
<code style="box-sizing: border-box; display: inline; font-family: monospace,monospace; font-size: 14px; line-height: 21px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left; vertical-align: baseline;">curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo</code>
CentOS 6
<code style="box-sizing: border-box; display: inline; font-family: monospace,monospace; font-size: 14px; line-height: 21px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left; vertical-align: baseline;">wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo</code>
或者
<code style="box-sizing: border-box; display: inline; font-family: monospace,monospace; font-size: 14px; line-height: 21px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left; vertical-align: baseline;">curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo</code>
CentOS 7
<code style="box-sizing: border-box; display: inline; font-family: monospace,monospace; font-size: 14px; line-height: 21px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left; vertical-align: baseline;">wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo</code>
或者
<code style="box-sizing: border-box; display: inline; font-family: monospace,monospace; font-size: 14px; line-height: 21px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left; vertical-align: baseline;" data-spm-anchor-id="0.0.0.i4.18b8c8ebinV6VS">curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo</code>
命令复制所需内容即可
就完成yum源下载
扩展yum源
1.先进行下载
yum install epel-release -y
2.进行扩展
1.登录网站 https://opsx.alibaba.com/mirror ctrl +f 页面搜索 epel
寻找当前行? 然后进行备份
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
二选一
2.
2、下载新repo 到/etc/yum.repos.d/
epel(RHEL 7)
<code style="box-sizing: border-box; display: inline; font-family: monospace,monospace; font-size: 14px; line-height: 21px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left; vertical-align: baseline;"> wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo</code>
epel(RHEL 6)
<code style="box-sizing: border-box; display: inline; font-family: monospace,monospace; font-size: 14px; line-height: 21px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left; vertical-align: baseline;"> wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo</code>
epel(RHEL 5)
<code style="box-sizing: border-box; display: inline; font-family: monospace,monospace; font-size: 14px; line-height: 21px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left; vertical-align: baseline;"> wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo</code>
文件达到20000
就完成扩展源