CentOS上使用yum安装软件,总是报错:
[root@localhost ~]# yum update CentOS-8 - AppStream 70 B/s | 38 B 00:00 Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
或者 yum install epel-release 也是报同样的错误
原因是CentOS8的官方yum源已经停止维护了,需要切换到 vault.centos.org
按如下操作即可:
cd /etc/yum.repos.d/ sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* yum clean all && yum makecache
后面继续使用yum安装软件就可以了
文章评论