错误:为仓库 ‘appstream‘ 下载元数据失败 : Cannot prepare internal mirrorlist: No URLs

问题描述

今天2022218日在CentOS 8上安装软件时,遇到如下报错:

 

CentOS Linux 8 - AppStream 错误:为仓库 ‘appstream’ 下载元数据失败 : Cannot prepare internal mirrorlist: No URLs in mirrorlist

 在网上一顿搜索也没能解决,最终在csdn找到了答案!网址为:https://blog.csdn.net/wykqh/article/details/123004620

 问题原因

CentOS Linux 820221231日来到生命周期终点(End of LifeEoL)。即CentOS Linux 8操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。所以原来的CentOS Linux 8yum源也都失效了!最终导致此问题的产生。

问题解决方法

更换CentOS Linux 8yum

 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

 

 

 

 

2、下载新的源文件,并用命令yum makecache建立新的元数据缓存

 下载源文件命令:

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
[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]#

3、测试源(用yum命令装个软件试试)

 

 

 

 

 

yum源已经可以正常使用了,问题最终得到解决!特此记录,以备查用!

posted @ 2022-11-17 16:47  ◆◇dear丶妖孽╮ゞ  阅读(2249)  评论(0编辑  收藏  举报
……
芋、头、sleepwalking、…