问题
Centos8于2021年年底停止了服务,在使用yum源安装时,出现错误:Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
解决
1、进入yum的repos目录
[root@localhost ~]# cd /etc/yum.repos.d/
2、修改所有的CentOS文件内容
[root@localhost yum.repos.d]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@localhost yum.repos.d]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
3、更新yum源为阿里镜像
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
4、yum安装测试,是否可以yum安装
[root@localhost yum.repos.d]# yum install wget -y