yum换源
背景描述
源:阿里云:
系统:centos7
https://developer.aliyun.com/mirror/
其他参考地址:
https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11UchtP5https://developer.aliyun.com/mirror/centos-vault?spm=a2c6h.13651104.d-2001.2.4257320cLEd4fv
操作步骤
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sudo wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
FAQ
1、非阿里云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
2、报错:Cannot find a valid baseurl for repo: centos-sclo-rh/x86_64
cd /etc/yum.repos.d/
sudo rm -rf *
重新执行换源操作步骤