Saturday, August 17, 2024

Errors during downloading metadata for repository 'appstream': - Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]

 Error while installing a package in CentOS 8

Errors during downloading metadata for repository 'appstream':   - Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]

How to fix?

1. Login to the server

2. cd /etc/yum.repos.d/

3. sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*

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

5. yum install <package>

It works!