CentOs 7 YUM update not working

Edit your /etc/yum.conf file and add



http_caching option controls how to handle any HTTP downloads that YUM does and what yum should caches. Its default setting is to cache all downloads and that includes repo metadata.

So If the metadata file gets corrupted during download (exp: it is partially downloaded), yum will not be able to verify the remote availability of packages and it will fail.

The solution is to add http_caching=packages to /etc/yum.conf so yum will only cache packages and it will download new repository metadata each time.

The following also works:

yum clean all
yum makecache
yum update

I had a VM that hadn't been updated in a long while, and doing a yum makecache fast and yum update worked for me.