Yum on Centos 8 - Failed to download metadata for repo 'AppStream'

Solution 1:

You need to be connected to the Internet in order to download packages.

Check that you have an IP address (with ip a), that you have a default route (with ip r), and that you have nameservers defined so you can resolve names (with cat /etc/resolv.conf).

Solution 2:

Apparently not the problem here, but if you have "pinned" yourself to CentOS 8.1.1911 you will get the same error until you re-point your /etc/yum.repos.d/ repositories at http://vault.centos.org instead of http://mirror.centos.org

Solution 3:

I got the same error message when installing PHP. It was caused by the network configuration: after changing the gateway address in /etc/sysconfig/network-scripts/ifcfg-enp2s0 the problem was solved. Probably caused by changing from DHCP to a static IP-Address. The information in my internet-router was misleading. I just used the first address in my LAN, in my case: 192.168.11.1. It is the address of the management-console of my router.