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

相关推荐

  • App如何推广?

    ( 1) app下载渠道分布 1. 安卓应用日均下载量约为1.3亿,iOS应用日均下载量5000万。 2. 应用市场和PC管理套件由于起步早,培养了用户的下载习惯,已成为首选的应用下载道。 (2)用户下载行为分析 1.用户初次下载,来自推荐以及搜索。 2.一些推广人员利用某些市场排名规则,进行恶意优化,占据大量热门APP名称,使用户在搜索关键词命中这些热门APP名称时搜索结果排序靠前,以及优

    2022-12-30 00:47:45
  • 日本本地快递公司有哪些

    1. 日本邮政(Japan Post) 日本邮政是日本最大的快递和邮政服务公司,由日本政府全资拥有。它提供包括信件、包裹、快递和金融服务在内的广泛服务。日本邮政的快递服务部门称为“ゆうパック”(Yuu Pack),提供国内和国际快递服务。其服务网络遍布日本全国,甚至是最偏远的地区也能覆盖。日本邮政还提供定时配送服务,满足不同客户的需求。 2. Yamato Transport(ヤマト運輸) Yamato Trans

    2024-11-09 09:51:20