When I'm trying to update in CentOS 8 using the "yum update" command, received an "Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist"

The solution is, go to the yum repository location /etc/yum.repos.d/

 cd /etc/yum.repos.d/

And executed the commands below,

$ 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-*​

Now, we can update the repositories using the command,

$ sudo yum update -y