Failed to Download Metadata for Repo ...

This section provides a tutorial example on how to fix the error, Failed to Download Metadata for Repo 'AppStream', on CentOS 8 computer.

As you may known, CentOS Linux 8 had reached the End Of Life (EOL) on December 31st, 2021. There will be no more updates to CentOS 8 and its packages are moved to the archive repository vault.centos.org from mirror.centos.org.

If you running "dnf/yum" commands with mirror.centos.org repository on your CentOS 8 computer, you will get the following message: "Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist". For example:

herong$ sudo dnf info wget

CentOS Linux 8 - AppStream                    90  B/s |  38  B     00:00
Error: Failed to download metadata for repo 'appstream':
  Cannot prepare internal mirrorlist: No URLs in mirrorlist

To continue maintaining software packages on your CentOS 8 computer, you need to update your package repository configuration files as shown below:

1. Backup repository configuration files:

herong$ cd /etc/yum.repos.d

herong$ sudo mkdir backup

herong$ sudo cp -p CentOS-*.repo backup

2. Stop using 'mirrorlist.centos.org' and open 'baseurl' to vault.centos.org:

herong$ sudo sed -i 's|mirrorlist|#mirrorlist|g' CentOS-*.repo

herong$ sudo sed -i \
  's|#baseurl=http://mirror|baseurl=http://vault|g' CentOS-*.repo

herong$ sudo grep vault CentOS-*.repo

3. Try to run "dnf/yum" commands again. I see no problem accessing CentOS Linux 8 repositories:

herong$ sudo dnf info wget
CentOS Linux 8 - AppStream                    2.0 MB/s | 8.4 MB     00:04
CentOS Linux 8 - BaseOS                       423 kB/s | 4.6 MB     00:11
CentOS Linux 8 - Extras                       4.2 kB/s |  10 kB     00:02

Installed Packages
Name         : wget
Version      : 1.19.5
Release      : 10.el8
Architecture : x86_64
Size         : 2.8 M
Source       : wget-1.19.5-10.el8.src.rpm
Repository   : @System
From repo    : AppStream
...

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

 Memory Management

 Files and Directories

 Users and Groups

 File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

Software Package Manager on CentOS - DNF and YUM

 What Is DNF

 Manage DNF Package Repositories

 What Is YUM

 What Is RPM

 What Is pkgs.org

 Install and Manage Java Packages on CentOS

 Install and Manage Perl Packages on CentOS

 Install "git-core" for GitHub Packages on CentOS

Failed to Download Metadata for Repo ...

 Replacing CentOS Repositories to Local Mirrors

 vsftpd - Very Secure FTP Daemon

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB