2024年最新:配置CentOS 7阿里yum源

前言

根据CentOS官方声明,CentOS 7的支持已于2024年6月30日正式终止,伴随而来的是软件仓库从上游的移除。

国内镜像站如阿里云、TUNA等已同步下架了CentOS 7(涵盖el7、rhel7及centos7等版本)的软件包,导致多数现有YUM源配置教程失效。

尽管如此,这些镜像站为维持用户过渡,提供了CentOS 7等停服版本的历史归档服务,允许继续使用该系统的用户切换至相应的归档YUM源以维持操作。

一、备份yum源配置文件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak

 

二、新建阿里云YUM源配置文件

 

下面将以CentOS 7.9为例配置阿里云yum源,其他版本的CentOS 7可以将配置文件中的7.9.2009全部替换为你使用的系统版本,如:7.8.2003、7.7.1908等

新建yum仓库配置文件

vi /etc/yum.repos.d/CentOS-Base.repo

点击i键进入编辑模式,将以下配置信息复制到配置文件中

# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client.  You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead.#[base]name=CentOS-$releasever - Base - mirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/os/$basearch/gpgcheck=1gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-7
#released updates [updates]name=CentOS-$releasever - Updates - mirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/updates/$basearch/gpgcheck=1gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful[extras]name=CentOS-$releasever - Extras - mirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/extras/$basearch/gpgcheck=1gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plus - mirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contrib - mirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/contrib/$basearch/gpgcheck=1enabled=0gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-7

 

点击Esc键退出编辑模式,输入:wq保存配置文件

三、清除缓存并重建元数据缓存

 

yum clean all && yum makecache

20240921023803742

至此阿里云YUM源已经切换成功,可以尽情使用了

 

 

暂无介绍....

延伸阅读:

三丰云上面的数据全部丢失

今天三丰云那个CMS网站无法访问,上面虽然放了不少东西,但是却没有特别贵重的数据我就工单问了一下客服,客服告诉我说什么被...

admin
2024年10月28日
【转】三丰云免费服务器和付费产品简单测评

 如果大家对三丰云这个名字有些陌生,那么你一定听说过主机屋、ID666、中网、爱迪通联、阿肖站长这些名字,没错...

admin
2024年10月26日
买服务器不要再花冤枉钱了,盘点几款不错的云服务器

云服务器常见用途有网站托管、数据存储与备份、运行软件应用、进行大规模数据处理等。它具有灵活性高、可扩展性强、成本较低等优...

admin
2024年10月26日
不买香港云服务器也可以

我大概整理了一下我所需要的云服务器主要应该是需要国内线路的,这个目前我使用的有阿里云199的 2h4g,目前够用了海外云...

admin
2024年10月26日
青云主机的免费虚拟空间(1元/年实名)

演示地址:049.com.cn申请地址:https://www.qyidc.net/cart?fid=5&gid...

admin
2024年10月25日