yum update -y
CentOS-8 - AppStream 118 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
执行下面的命令就可以了
cd /etc/yum.repos.d/
#这样做是为了停用 mirrorlist 方式获取仓库镜像地址。
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-*
#下载阿里云的 CentOS 8.5.2111 版本仓库配置文件
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repoyum clean allyum makecacheyum install wget –y