Tuesday, January 03, 2023

CentOS 8 - Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

After I had not updated my CentOS 8 for a while, I used the command "yum update" or "dnf update" for the update, but I encountered the below error:


To fix this error, you can run the below commands:

$sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* 
$sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

Reference: Stackoverflow