centos7,2024年6月30日停止维护(EOL,End Of Life),自此时间后Centos7将无法使用Centos社区官方提供的yum源下载软件,当使用默认源下载时会报如下错误:
curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error" ... Cannot find a valid baseurl for repo: base/7/x86_64 或者 Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
表示官方软件仓库的域名地址(mirrorlist.centos.org)已经被删除了解析,已无法访问,建议用户更换其他系统,如果您一定要使用CentOS 7.x,那么只能将系统的yum源更换为第三方yum源。
以下是将yum源更换为阿里云的教程。
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum clean all yum makecache
如果你是完全mini安装的centos还没有 curl工具,可以尝试以下命令然后再 clean和make。
vi /etc/yum.repos.d/CentOS-Base.repo [base] name=CentOS-$releasever - Base baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 [updates] name=CentOS-$releasever - Updates baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 [extras] name=CentOS-$releasever - Extras baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 对于centos 8 可以进行如下操作 sudo rm -rf /etc/yum.repos.d/* sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo sudo yum clean all sudo yum makecache =============== sudo cp -r /etc/yum.repos.d /etc/yum.repos.d.bak #先进行备份 sudo mv /etc/yum.repos.d.bak /etc/yum.repos.d #如果删除后有错误需要进行恢复
想了解更多关于CentOS 7官方停止维护yum源安装报错,如何修改yum源为阿里云的内容,请扫微信
或微信搜索jiemingpan
本文链接:http://www.soufuzi.com/jianzhan/3104