美文网首页
CentOS6.x/7.x/8.x更改为阿里云yum源

CentOS6.x/7.x/8.x更改为阿里云yum源

作者: 静美书斋 | 来源:发表于2019-03-15 15:40 被阅读0次

将CentOS的yum源更换为国内的阿里云源

摘要: 阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/

第一步:备份你的原镜像文件,以免出错后可以恢复。

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

第二步:

wget -O或者curl -0

CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

CentOS 8
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

更改CentOS-Media.repo使其为不生效:

vim /etc/yum.repos.d/CentOS-Media.repo

enabled=0

第三步:

yum clean all && yum makecache
yum update -y

其他

1、安装CentOS7 更新失败,更改其配置文件:%s/$releasever/7/g
2、非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。用户也可自行修改相关配置: eg:

sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

文章参考

相关文章

网友评论

      本文标题:CentOS6.x/7.x/8.x更改为阿里云yum源

      本文链接:https://www.haomeiwen.com/subject/xbfrmqtx.html