2025年centos 7 亲测可用阿里源

目前这个问题 AI 可回答不上来 ,因为网上说的对的文章太少啦。为防止找不到我,就点个关注吧~

拿阿里云的官网文档来说,centos7是不可用的。
https://mirrors.aliyun.com/repo/Centos-7.repo 这个文件你下载后也是不能用的。会报404,仔细对比后发现,由于CentOS 8操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。所以无论是版本8 还是之前的 7 或者 6,都要使用 centos-vault 源。

而下载得到的Centos-7.repo 文件中是没有配置为 centos-vault 的,并且还要精确写对小版本号,单独的7 目录是不存在的,我们就选用最后一个小版本。

7.0.1406/ 	- 	2015-04-07 22:36
7.1.1503/ 	- 	2015-11-13 21:01
7.2.1511/ 	- 	2016-05-19 00:48
7.3.1611/ 	- 	2017-02-21 06:21
7.4.1708/ 	- 	2018-02-26 22:32
7.5.1804/ 	- 	2018-05-10 04:39
7.6.1810/ 	- 	2018-12-02 22:34
7.7.1908/ 	- 	2019-09-15 09:00
7.8.2003/ 	- 	2020-06-18 01:55
7.9.2009/

所以,总的来说 ,对于版本7来说,CentOS-Base.repo 中必须出现 类似 http://mirrors.aliyun.com/centos-vault/7.9.2009/ 这样的才能正常工作。

写完后你需要打开网址去检查一下,是否可正常访问: https://mirrors.aliyun.com/centos-vault/7.9.2009/

附上Centos 7正常可用的 CentOS-Base.repo 内容:

# 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-7.9.2009 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/7.9.2009/os/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/7.9.2009/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-7.9.2009 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/7.9.2009/updates/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/7.9.2009/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-7.9.2009 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/7.9.2009/extras/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/7.9.2009/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7.9.2009 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/7.9.2009/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/7.9.2009/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/7.9.2009/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS-7.9.2009 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/7.9.2009/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/7.9.2009/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/7.9.2009/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

知道了原理后,centos 6 本质是也是一样的。更改上面的7.9.2009版本为实际存在的版本即克。

而 Centos 8貌似用户比较多,阿里云文档中提供的链接下载后是可以直接使用的 。https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

rock——you

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值