[ root@HK ~]#yum install -y autofsCentOS-8 - AppStream 50 B/s | 38 B 00:00 Failed to download metadata for repo 'AppStream'Error: Failed to download metadata for repo 'AppStream'
还原快照后突然发现安装软件报错了[ root@HK ~]#yum install -y autofsCentOS-8 - AppStream 50 B/s | 38 B 00:00 Failed to download metadata for repo 'AppStream'Error: Failed to download metadata for repo 'AppStream'
查看yum.repos.d,发现 base.repo 和 AppStream.repo 里面的 baseurl地址已经访问不了了[baseOS]name=CentOS-$releasever - basemirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=baseOS&infra=$infra#baseurl=http://mirror.centos.org/$contentdir/$releasever/baseOS/$basearch/os/gpgcheck=1enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
进入阿里官网找到 centos8 的 repocentos8.1的 repo
复制这个链接 修改base.repo,加上注释 mirrorlist,注释掉 baseurl,粘贴链接在 baseurl后面[ root@HK /etc/yum.repos.d]#vim CentOS-base.repo [baseOS]name=CentOS-8.1 - base#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=baseOS&infra=$infrabaseurl=https://mirrors.aliyun.com/centos-vault/8.1.1911/baseOS/x86_64/os/gpgcheck=0enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
修改 AppStream.repo ,加上注释 mirrorlist,注释掉 baseurl,粘贴链接在 baseurl 后面[ root@HK /etc/yum.repos.d]#vim CentOS-AppStream.repo [AppStream]name=CentOS-8.1 - AppStream#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infrabaseurl=https://mirrors.aliyun.com/centos-vault/8.1.1911/baseOS/x86_64/os/gpgcheck=0enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
执行下面两个命令后无报错即可[ root@HK /etc/yum.repos.d]#yum clean all32 files removed[ root@HK /etc/yum.repos.d]#yum makecacheCentOS-8.1 - AppStream 3.2 MB/s | 2.2 MB 00:00 CentOS-8.1 - base 8.3 MB/s | 2.2 MB 00:00 CentOS-8 - Extras 15 kB/s | 10 kB 00:00 metadata cache created.