Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stoc

由于CentOS官方在2024年6月30日结束了对CentOS 7的支持,官方提供的yum源也随之下线,导致默认的yum源无法正常使用‌。系统内置的 yum.repo 所使用的域名 http://mirrorlist.centos.org地址都不能访问。导致新安装Centos 7系统不能使用yum命令。

使用yum命令会报错:

[root@localhost yum.repos.d]# yum -y install  vim 
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
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; 未知的错误"

解决:

1.备份原来的yum源:

[root@localhost yum.repos.d]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir repoback 
[root@localhost yum.repos.d]# mv * repoback/
mv: 无法将目录"repoback" 移动至自身的子目录"repoback/repoback" 下

2.下载yum源:

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

3.清理缓存源,重新加载阿里源:

yum clean all

yum makecache

4.检查yum源:

 yum repolist
[root@localhost yum.repos.d]# yum clean all
已加载插件:fastestmirror
正在清理软件源: base extras updates
Cleaning up list of fastest mirrors

[root@localhost yum.repos.d]# yum makecache 
已加载插件:fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                                                                       | 3.6 kB  00:00:00     
extras                                                                                                                                                                                                     | 2.9 kB  00:00:00     
updates                                                                                                                                                                                                    | 2.9 kB  00:00:00     
(1/10): base/7/x86_64/group_gz                                                                                                                                                                             | 153 kB  00:00:00     
(2/10): base/7/x86_64/other_db                                                                                                                                                                             | 2.6 MB  00:00:00     
(3/10): extras/7/x86_64/other_db                                                                                                                                                                           | 154 kB  00:00:00     
(4/10): updates/7/x86_64/filelists_db                                                                                                                                                                      |  15 MB  00:00:03     
(5/10): updates/7/x86_64/primary_db                                                                                                                                                                        |  27 MB  00:00:06     
(6/10): updates/7/x86_64/other_db                                                                                                                                                                          | 1.6 MB  00:00:00     
base/7/x86_64/primary_db       FAILED                                          
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/6d0c3a488c282fe537794b5946b01e28c7f44db79097bb06826e1c0c88bad5ef-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.cloud.aliyuncs.com:80; Connection refused"
正在尝试其它镜像。
base/7/x86_64/filelists_db     FAILED                                          
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/d6d94c7d406fe7ad4902a97104b39a0d8299451832a97f31d71653ba982c955b-filelists.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
正在尝试其它镜像。
extras/7/x86_64/primary_db     FAILED                                          
http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/e12dbf10e94bc2b33b1f45e026559bc8685728b139dddae0654d96bc624c5602-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
正在尝试其它镜像。
(7/10): extras/7/x86_64/primary_db                                                                                                                                                                         | 253 kB  00:00:00     
(8/10): base/7/x86_64/primary_db                                                                                                                                                                           | 6.1 MB  00:00:01     
(9/10): base/7/x86_64/filelists_db                                                                                                                                                                         | 7.2 MB  00:00:02     
extras/7/x86_64/filelists_db   FAILED                                          
http://mirrors.aliyun.com/centos/7/extras/x86_64/repodata/4714f6e99a17fd299715585b9b8ab7cbb77f9ec78dab4f2767db658af02993b0-filelists.sqlite.bz2: [Errno 12] Timeout on http://mirrors.aliyun.com/centos/7/extras/x86_64/repodata/4714f6e99a17fd299715585b9b8ab7cbb77f9ec78dab4f2767db658af02993b0-filelists.sqlite.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
extras/7/x86_64/filelists_db   FAILED                                          
http://mirrors.cloud.aliyuncs.com/centos/7/extras/x86_64/repodata/4714f6e99a17fd299715585b9b8ab7cbb77f9ec78dab4f2767db658af02993b0-filelists.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.cloud.aliyuncs.com:80; Connection refused"
正在尝试其它镜像。
extras/7/x86_64/filelists_db   FAILED                                          
http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/4714f6e99a17fd299715585b9b8ab7cbb77f9ec78dab4f2767db658af02993b0-filelists.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
正在尝试其它镜像。
(10/10): extras/7/x86_64/filelists_db                                                                                                                                                                      | 305 kB  00:00:00     
元数据缓存已建立

[root@localhost yum.repos.d]# yum repolist 
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
源标识                                                                                            源名称                                                                                                                    状态
base/7/x86_64                                                                                     CentOS-7 - Base - mirrors.aliyun.com                                                                                      10,072
extras/7/x86_64                                                                                   CentOS-7 - Extras - mirrors.aliyun.com                                                                                       526
updates/7/x86_64                                                                                  CentOS-7 - Updates - mirrors.aliyun.com                                                                                    6,173
repolist: 16,771

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

小邋遢2.0

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

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

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

打赏作者

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

抵扣说明:

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

余额充值