Error: Failed to doumload metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
出现这种问题是因为centos8的仓库源出了问题,需要配置新的仓库源
当出现这种报错时,先ping一下,查看网络是否通畅,可以ping百度
[root@localhost yum.repos.d]# ping baidu.com PING baidu.com (220.181.38.148) 56(84) bytes of data. 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=128 time=20.4 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=128 time=21.6 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=128 time=21.2 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=128 time=22.6 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=5 ttl=128 time=20.4 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=6 ttl=128 time=20.8 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=7 ttl=128 time=20.8 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=8 ttl=128 time=20.8 ms ^C --- baidu.com ping statistics --- 8 packets transmitted, 8 received, 0% packet loss, time 7015ms rtt min/avg/max/mdev = 20.390/21.076/22.637/0.715 ms
可以看到网络没问题,进行下一步
[root@localhost yum.repos.d]# pwd /etc/yum.repos.d
按照路径进入目录,创建backup目录,把原来的配置文件转移
[root@localhost yum.repos.d]# mv *.repo backup [root@localhost yum.repos.d]# ll total 4 drwxr-xr-x. 2 root root 4096 Feb 19 10:04 backup [root@localhost yum.repos.d]# cd backup [root@localhost backup]# ll total 52 -rw-r--r--. 1 root root 172 Feb 19 01:52 BaseOS.repo -rw-r--r--. 1 root root 678 Feb 19 16:40 CentOS-Linux-AppStream.repo -rw-r--r--. 1 root root 662 Feb 19 03:46 CentOS-Linux-BaseOS.repo -rw-r--r--. 1 root root 1130 Nov 10 2020 CentOS-Linux-ContinuousRelease.repo -rw-r--r--. 1 root root 318 Nov 10 2020 CentOS-Linux-Debuginfo.repo -rw-r--r--. 1 root root 732 Nov 10 2020 CentOS-Linux-Devel.repo -rw-r--r--. 1 root root 704 Nov 10 2020 CentOS-Linux-Extras.repo -rw-r--r--. 1 root root 719 Nov 10 2020 CentOS-Linux-FastTrack.repo -rw-r--r--. 1 root root 740 Nov 10 2020 CentOS-Linux-HighAvailability.repo -rw-r--r--. 1 root root 693 Nov 10 2020 CentOS-Linux-Media.repo -rw-r--r--. 1 root root 706 Nov 10 2020 CentOS-Linux-Plus.repo -rw-r--r--. 1 root root 724 Nov 10 2020 CentOS-Linux-PowerTools.repo -rw-r--r--. 1 root root 898 Nov 10 2020 CentOS-Linux-Sources.repo
从阿里云镜像站下载新的 CentOS-Base.repo库 到 /etc/yum.repos.d
使用的代码:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
如果wget不能用,就用curl
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
看到有新的CentOS-Base.repo出现,就可以正常使用yum下载了
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2495 100 2495 0 0 9486 0 --:--:-- --:--:-- --:--:-- 9486 [root@localhost yum.repos.d]# ll total 16 drwxr-xr-x. 2 root root 4096 Feb 19 16:30 backup -rw-r--r--. 1 root root 2495 Feb 19 17:53 CentOS-Base.repo
版权声明:本文为Zhanglovemeng原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。