1、非阿里云ECS需要执行以下代码
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
2、备份原CentOS-Base.repo文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
3、使用wget下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
4、运行 yum makecache 生成缓存
如果提示wget command not found 则没有安装wget
yum install wget 即可
错误:can not find a valid baseurl for repo: base/7/x86-64
详见:CentOs7 linux yum命令执行can not find a valid baseurl for repo: base/7/x86-64
原创文章,作者:Tingwep,如若转载,请注明出处:https://tingwep.cn/linux/id=367