解决CentOS8无法使用yum安装
[root@localhost ~]# yum install vim
CentOS-8 - AppStream 53 B/s | 38 B 00:00
Failed to download metadata for repo ‘AppStream’
Error: Failed to download metadata for repo ‘AppStream’
1、删除AppStream源
[root@localhost ~]# rm -f /etc/yum.repos.d/CentOS-AppStream.repo
2、取消并备份旧yum源(可直接删除)
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
3、下载vault源
[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 19801 0 --:--:-- --:--:-- --:--:-- 19801
4、清除yum缓存
[root@localhost ~]# yum clean all
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
6 files removed
5、生成新缓存
[root@localhost ~]# yum makecache
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
CentOS-8.5.2111 - Base - mirrors.aliyun.com 5.4 MB/s | 4.6 MB 00:00
CentOS-8.5.2111 - Extras - mirrors.aliyun.com 60 kB/s | 10 kB 00:00
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com 6.1 MB/s | 8.4 MB 00:01
Metadata cache created.