Solve the error: Failed to download metadata for repo 'AppStream'Error: Failed to download metadata for repo 'AppStream'
When yum install -y httpd
installing httpd, an error message appears:
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'
Solution:
1. Go to the repos directory of yum
cd /etc/yum.repos.d/
2. Modify the content of the centos file
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-*
3. Generate a cache update (the first update, the speed is a little slow, wait patiently for about two minutes)
yum makecache
4. Run yum install -y httpd
yum install -y httpd
So far, the problem has been successfully solved!
- View httpd status
systemctl status httpd.service
- open httpd
sudo service httpd start