一、问题
二、原因
三、解决方案
究其原因是Centos停止维护其yum源也相应被停止了,所以我们需要更换centos的yum源为阿里源。以下以CentOS 7.x为例展示:
1. 备份当前 Yum 源
备份当前的 Yum 源配置文件:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo-history
2. 拉取阿里最新的 Yum 源配置文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
这里下载的是阿里云的centos7 yum源。
更多版本源请访问
3. 清除 Yum 缓存
yum clean all
如果此处仍然报错"Could not resolve host: mirrorlist.centos.org; Unknown error",请排查/etc/yum.repos.d路径下所有.repo文件内是否含有mirrorlist.centos.org地址文件,如有备份后删除源文件重新执行该命令即可。
4. 生成新的缓存
yum makecache