在CentOS8上使用yum时报错
CentOS-8 - AppStream 94 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
解决方法:修改CentOS-Base.repo和CentOS-AppStream.repo内容
[root@centos80 ~]# cd /etc/yum.repos.d/
[root@centos80 yum.repos.d]# ll
total 48
-rw-r--r--. 1 root root 808 Mar 25 11:15 CentOS-AppStream.repo
-rw-r--r--. 1 root root 793 Mar 25 11:14 CentOS-Base.repo
-rw-r--r--. 1 root root 1292 Aug 4 2021 CentOS-CDROM.repo
-rw-r--r--. 1 root root 798 Aug 14 2019 CentOS-centosplus.repo
-rw-r--r--. 1 root root 1320 Aug 14 2019 CentOS-CR.repo
-rw-r--r--. 1 root root 668 Aug 14 2019 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 756 Aug 14 2019 CentOS-Extras.repo
-rw-r--r--. 1 root root 338 Aug 14 2019 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 928 Aug 14 2019 CentOS-Media.repo
-rw-r--r--. 1 root root 736 Aug 14 2019 CentOS-PowerTools.repo
-rw-r--r--. 1 root root 1382 Aug 14 2019 CentOS-Sources.repo
-rw-r--r--. 1 root root 74 Aug 14 2019 CentOS-Vault.repo
[root@centos80 yum.repos.d]# vi CentOS-Base.repo
[baseos]
name=CentOS Linux $releasever - BaseOS
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
baseurl=https://vault.centos.org/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@centos80 yum.repos.d]# vi CentOS-AppStream.repo
[AppStream]
name=CentOS-$releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
baseurl=https://vault.centos.org/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@centos80 yum.repos.d]# yum clean all
Repository AppStream is listed more than once in the configuration
0 files removed
[root@centos80 yum.repos.d]# yum makecache
Repository AppStream is listed more than once in the configuration
CentOS-8 - AppStream 5.6 MB/s | 8.4 MB 00:01
CentOS Linux 8 - BaseOS 4.0 MB/s | 4.6 MB 00:01
CentOS-8 - Extras 181 B/s | 11 kB 01:00
Metadata cache created.