We're writing the tutorial to fix the issue of the mentioned title, because, one of our clients reported to us, he is unable to install any software on his server. When he provided us the root access, we found that the AppStream repo was causing the issue.
"CentOS Linux 8 had reached the End Of Life (EOL) on December 31st, 2021". It means that CentOS 8 will no longer receive development resources from the official CentOS project, after Dec 31st, 2021.
So we go-ahead to change the mirrors of CentOS 8 to vault.centos.org where they will be archived permanently. Here's how we did the process:
Step 1: Go to the /etc/yum.repos.d/ directory.
Step 2: Run the below commands
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-*
Step 3: Now run the yum update
yum update -y