Linux - Centos7+配置阿里云 yum 源
备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 或 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo # 163 的源 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo # centos6 系统更新源方式 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo # centos8 系统更新源方式 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
生成缓存,更新yum源
yum clean all yum makecache yum -y update
非阿里云ECS用户
可能会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。可自行修改相关配置
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo