This is probably not working due to the fact that CentOS Linux 8 has reached EOL. As per the official article, the contents of the official repository of CentOS Linux 8 were removed from http://mirror.centos.org/ to http://vault.centos.org/, where it will be archived permanently since Centos Linux 8 will not be able to provide updates to the content after the EOL date.
Workaround 1: Refer to Aaron Kili’s article on Tecmint
To fix the error, open your terminal or login via ssh, and run the following commands to change the repo URL to point to vault.centos.org, from the official CentOS repos.
Here you can use the sed command to edit the required directives or parameters in the repo configuration files:
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-*
Workaround 2 : Refer to Techglimpse content written by Ramya Santhosh. Follow the below steps to resolve your issue:
Step 1: Go to the /etc/yum.repos.d/
directory.
[root@autocontroller ~]# cd /etc/yum.repos.d/
Step 2: Run the below commands
[root@autocontroller ~]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@autocontroller ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Step 3: Now run the yum update
[root@autocontroller ~]# yum update -y