Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Fix "Failed to Download Metadata for Repo AppStream" on CentOS

This guide helps you fix the AppStream metadata error on CentOS 8. It needs root access, so it is for VPS and dedicated server customers.

Domains and DNS2 min read6 steps

What is this error?

A repository (repo) is an online store of software. Your server downloads programs from it with a tool called dnf or yum. Metadata is the list that tells the server what is in the store.

The error looks like this:

Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

CentOS 8 reached its end of life. That means it no longer gets updates. Its old mirror addresses were moved, so the server cannot find the list any more.

Tip: CentOS 8 is old software. Newer systems such as AlmaLinux or Rocky Linux work in a similar way, and they are still supported.

Before you start

You are going to edit system files. Take a backup or a snapshot of your server first. A backup is a spare copy you can restore if something goes wrong.

Steps

  1. Log in to your server as root with SSH. SSH is a safe way to type commands on a faraway computer.
  2. Go to the repo folder:
    cd /etc/yum.repos.d/
    This moves you into the folder that holds the repo files.
  3. Turn off the dead mirror lists:
    sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
    This puts a # in front of the old lines, so the server ignores them.
  4. Point the repo files to the archive address:
    sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
    The vault is where CentOS keeps its old releases.
  5. Clean the saved data:
    dnf clean all
    This removes old cached lists.
  6. Build the new list:
    dnf makecache
    This downloads the metadata again. It should finish without an error.

Test it

Run dnf update or install a small program. If it works, the fix is done.

A better long-term choice

The vault only holds old, final files. It gets no security fixes. Think about moving to a supported system, such as CentOS Stream, AlmaLinux or Rocky Linux. Plan this move with care and keep a full backup. Hostvento support can advise you.

Quick recap

  • The error comes from CentOS 8 reaching end of life.
  • Back up first, then edit the files in /etc/yum.repos.d/.
  • Comment out mirrorlist and point baseurl to vault.centos.org.
  • Run dnf clean all and dnf makecache.
  • Plan a move to a supported system.