【linux】centos7不支持更新后,yum源失效问题!
1、yum安装时提示该错误。
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=aarch64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
原因:yum源官方不支持更新了,要换源
2、先备份源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
3、下载新源
①windows下
centos7:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
其他版本:
https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b118h66wX
注意:
如果运行yum还报错:
http://mirrors.aliyun.com/centos/7/os/aarch64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
可能原因之一是你是mac电脑安装的fusion虚拟机需要下载下面的源(之前下载的可以删除也可以再备份)
②新版mac(m芯片arm架构下)
wget http://mirrors.aliyun.com/repo/Centos-altarch-7.repo -O /etc/yum.repos.d/CentOS-Base.repo
4、下载完之后运行
yum makecache
5、其他
解决: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
引用:
https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b118h66wX