本文摘自PHP中文网,作者V,侵删。

具体步骤:
(推荐教程:centos教程)
1、备份
1 | mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
|
或
1 | mv /etc/yum/repos.d/CentOS-Base.repo{,.date -I}
|
2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
1 | wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
|
或者
1 | curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
|
CentOS 6
1 | wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
|
或者
1 | curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
|
CentOS 7
1 | wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
|
或
1 | curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
|
(视频教程推荐:linux视频教程)
3、添加EPEL
CentOS 6
1 | wget -O /etc/yum.repos.d/epel-6.repo http://mirrors.aliyun.com/repo/epel-6.repo
|
CentOS 7
1 | wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
|
4、清理缓存并生成新的缓存
1 2 | yum clean all
yum makecache
|
完成!
以上就是centos7更换国内yum源的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
如何进行CentOS7临时修改ip和永久修改ip
怎么解决CentOS7忘记root密码的问题
linux之CentOS7系统加固知识点小结
CentOS7怎么安装桌面环境
CentOS7的网卡启动出问题的解决方案
CentOS7系统启动流程
CentOS7的网卡启动出问题的解决方案
CentOS7如何使用yum安装php7.2
CentOS7下如何自动获取ip地址
CentOS7如何安装gcc?
更多相关阅读请进入《CentOS7》频道 >>
转载请注明出处:木庄网络博客 » centos7更换国内yum源