https://help.aliyun.com/zh/ecs/user-guide/change-centos-8-repository-addresses?spm=a2c4g.11186623.0.0.a65cad75ZzQ9Zw
1.运行以下命令备份之前的repo文件
rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo
2.运行以下命令下载最新的repo文件
wget http://mirrors.cloud.aliyuncs.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo
wget http://mirrors.cloud.aliyuncs.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo
3.运行以下命令替换repo文件中的链接
sed -i 's/http:\/\/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/http:\/\/mirrors.aliyun.com/http:\/\/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/url_tmp/http:\/\/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo
sed -i 's/http:\/\/mirrors.aliyun.com/http:\/\/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/epel-archive-8.repo
4.运行以下命令重新创建缓存
yum clean all && yum makecache
yum源和epel源切换完成后,即可使用yum install命令在实例上安装您所需要的软件包
标签:12,http,mirrors,源为,repos,repo,yum,com From: https://www.cnblogs.com/zhangdapangzo/p/17845634.html