今天2022年2月18日在CentOS 8上安装软件时,遇到如下报错:
在这里插入图片描述
CentOS Linux 8 – AppStream 错误:为仓库 ‘appstream’ 下载元数据失败 : Cannot prepare internal mirrorlist: No URLs in mirrorlist
在网上一顿搜索也没能解决,最终在阿里云开发者社区找到了答案!网址为:https://developer.aliyun.com/mirror/centos
问题原因
CentOS Linux 8在2022年12月31日来到生命周期终点(End of Life,EoL)。即CentOS Linux 8操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。所以原来的CentOS Linux 8的yum源也都失效了!最终导致此问题的产生。
问题解决方法
更换CentOS Linux 8的yum源
1、切换到源目录,备份原来的源
[root@17-132gui /]# cd /etc/yum.repos.d/
[root@17-132gui yum.repos.d]# ls -l
总用量 48
-rw-r–r–. 1 root root 719 2月 18 14:36 CentOS-Linux-AppStream.repo
-rw-r–r–. 1 root root 704 2月 18 14:36 CentOS-Linux-BaseOS.repo
-rw-r–r–. 1 root root 1130 9月 15 09:11 CentOS-Linux-ContinuousRelease.repo
-rw-r–r–. 1 root root 318 9月 15 09:11 CentOS-Linux-Debuginfo.repo
-rw-r–r–. 1 root root 732 9月 15 09:11 CentOS-Linux-Devel.repo
-rw-r–r–. 1 root root 704 9月 15 09:11 CentOS-Linux-Extras.repo
-rw-r–r–. 1 root root 719 9月 15 09:11 CentOS-Linux-FastTrack.repo
-rw-r–r–. 1 root root 740 9月 15 09:11 CentOS-Linux-HighAvailability.repo
-rw-r–r–. 1 root root 693 9月 15 09:11 CentOS-Linux-Media.repo
-rw-r–r–. 1 root root 706 9月 15 09:11 CentOS-Linux-Plus.repo
-rw-r–r–. 1 root root 724 9月 15 09:11 CentOS-Linux-PowerTools.repo
-rw-r–r–. 1 root root 1124 9月 15 09:11 CentOS-Linux-Sources.repo
[root@17-132gui yum.repos.d]# mkdir bak
[root@17-132gui yum.repos.d]# mv CentOS-Linux-* bak
[root@17-132gui yum.repos.d]# ls
bak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
在这里插入图片描述
2、下载新的源文件,并用命令yum makecache建立新的元数据缓存
下载源文件命令:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
1
[root@17-132gui yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
–2022-02-18 15:12:16– https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)… 124.95.160.238, 124.95.160.244, 124.95.160.243, …
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|124.95.160.238|:443… 已连接。
已发出 HTTP 请求,正在等待回应… 200 OK
长度:2495 (2.4K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”
/etc/yum.repos.d/CentOS-B 100%[===================================>] 2.44K –.-KB/s 用时 0s
2022-02-18 15:12:16 (21.2 MB/s) – 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2495/2495])
[root@17-132gui yum.repos.d]# ls
bak CentOS-Base.repo
[root@17-132gui yum.repos.d]# vim CentOS-Base.repo
[root@17-132gui yum.repos.d]# yum makecache
CentOS-8.5.2111 – Base – mirrors.aliyun.com 1.2 MB/s | 4.6 MB 00:03
CentOS-8.5.2111 – Extras – mirrors.aliyun.com 37 kB/s | 10 kB 00:00
CentOS-8.5.2111 – AppStream – mirrors.aliyun.com 1.1 MB/s | 8.4 MB 00:07
元数据缓存已建立。
[root@17-132gui yum.repos.d]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
3、测试源(用yum命令装个软件试试)
在这里插入图片描述
yum源已经可以正常使用了,问题最终得到解决!特此记录,以备查用!
————————————————
版权声明:本文为CSDN博主「日日行不惧千万里」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/wykqh/article/details/123004620