When ordering a VPS server with Centos 8, an error occurs when trying to update the system using yum update. Failed to load metadata. Below is the complete error:
yum update
CentOS-8 - AppStream 70 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
Linux CentOS 8 reached End of Life (EOL) on December 31, 2021. This means that CentOS 8 will no longer receive development resources from the official CentOS project. After December 31, 2021, if you need to upgrade CentOS, you need to change the mirrors to vault.centos.org where they will be archived permanently. Alternatively, you can upgrade to CentOS Stream.
1. Go to directory /etc/yum.repos.d/.
cd /etc/yum.repos.d/
2. Run the following 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-*
3. Now run update
yum update -y
Done.