
If you’re encountering the following error in CentOS 8 while trying to update packages using dnf update
or yum update
In this tutorial, we’re going to fix this issue.
Fixing CentOS 8: “Error: Failed to download metadata for repo appstream”
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
Fix: Migrate to CentOS Stream 8 or an alternative distro
CentOS users are switching to CentOS alternatives now because CentOS has switched to Stream – a rolling-release Linux distribution that sits halfway between upstream Fedora development and downstream RHEL development. Others have migrated to CentOS Stream 8 to stay with CentOS. Both of these options will allow you to update CentOS 8 despite the fact that you are unable to do so.
Migrate from CentOS 8 to CentOS Stream 8:
dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
dnf distro-sync
It will help you resolve the issue which you’re having updating packages or installing new packages. Let me know in the comments if you face any difficulties.