The newly installed CentOS8 system executes the yum command and reports an error
CentOS-8 - AppStream
failed to download metadata for repo 'AppStream'
ERROR: Failed to download metadata for repo 'AppStream'
Reason: The default yum source of the system cannot be requested
Modify the yum source configuration
1. Back up the original yum configuration
rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo
2. Download the latest Aliyun yum file
wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo && wget https://mirrors. aliyun.com/repo/epel-archive-8.repo -O/etc/yum.repos.d/epel-archive-8.repo
3. Replace the contents of the file
sed -i 's/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/epel-archive-8.repo && sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/yum.repos.d/epel-archive-8.repo
4. Clear and recreate the cache
yum clean all && yum makecache
Finally, execute yum installation