1. 程式人生 > 其它 >centos配置yum源-阿里

centos配置yum源-阿里

相關倉庫:
CentOS過期源(centos-vault):https://developer.aliyun.com/mirror/centos-vault

CentOS arm源(centos-altarch):https://developer.aliyun.com/mirror/centos-altarch/

CentOS Stream源(centos-stream):https://developer.aliyun.com/mirror/centos-stream

CentOS debuginfo源(centos-debuginfo):https://developer.aliyun.com/mirror/centos-debuginfo/

1. 備份

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

2. 下載新的 CentOS-Base.repo 到 /etc/yum.repos.d/

CentOS 7

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

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

3. 清理原yum源快取

yum clean all

4.生成快取

yum makecache
或者
yum repolist all

 其他
非阿里雲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