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

相关推荐

  • TM是什么意思_TM和R商标的区别

    TM商标和R商标代表什么意思 在我国市场上可以看到两种商标注册标志在使用:大多数是在商标的右上角或者右下角标注“®”或者“注”,也有一些是在商标的右上角或者右下角标注“TM”。出现这种情况,有的是跟商标使用人的国别有关系,比如英特尔公司就在自己的商标旁边标注“TM”;有些则处于一些商标代理从业人员的误导。 处于种种目的,有些不负责任的商标注册代理机构工作

    2023-04-01 23:12:26
  • 独立站的加购率公式

    加购率就是收藏(加购)人数除以周期内的访客数。 是用人数除以访客数,收藏(加购)人数就是指的是ID用户数。这个周期可以是7天、30天、反正由自己来决定。从而计算出某个周期内的收藏率(加购率)。 据统计,如果能在5分钟内回复顾客咨询的商家,相对下单率可以提高69%。其实不难理解,潜在用户在纠结是否购买你的商品时,如果能得到你的及时反馈,就会增其对你店铺的信心。因为他知道,在出现问题时,可以随时和你取得联系。

    2024-08-15 08:25:31