CentOS 7官方停止维护yum源安装报错,如何修改yum源为阿里云

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

(0)
上一篇 2025-05-10 18:16:11
下一篇 2025-05-10 18:16:11

相关推荐

  • 昆山市汽车客运中心站[昆山汽车站]

    网站地址:昆山市汽车客运中心站[昆山汽车站]  服务器IP:[ 103.81.171.216 ] 网站描述:昆山汽车站网上订票昆山市汽车客运中心站有限公司于2005年5月18日由苏州汽车客运集团有限公司、昆山市汽车客运公司、昆山市路桥建设(集团)有限公司三方根据“利益同享,风险共担,优势互补,共同发展”的原则,合作组建而成的非控股企业。公司实行总经理负责制,下设综合办公室、财审

    2024-07-26 07:56:17
  • 什么样的页面才是高质量的页面

        对于SEO人员强调的高质量的页面,那么什么样的页面才是高质量的页面呢?          一、内容互异性          包括与本站和其他网站页面的互异性;          二、内容丰富性

    2023-01-25 23:05:16