Skip to contentSkip to main navigation Skip to footer

Xử lý lỗi khi yum trên CentOS 8 – Failed to download metadata for repo ‘AppStream’

2022 03 28 210506

Tôi đã cài đặt một CentOS 8 tối giản trên một trong các máy chủ của mình. Cài đặt thành công, tuy nhiên, khi tôi cố gắng cập nhật hệ thống bằng cách sử dụng yum update, tôi thấy thông báo lỗi này: Không tải được siêu dữ liệu cho repo. Dưới đây là lỗi hoàn toàn.

[root@host110 ~]# yum update -y
CentOS-8 - AppStream                                                 92  B/s |  38  B     00:00
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'

Kiểm tra Log /var/log/dnf.log để biết thêm thông tin:

2022-02-02T11:39:36Z DEBUG error: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org] (http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock).
2022-02-02T11:39:36Z WARNING Errors during downloading metadata for repository 'AppStream':
- Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]
2022-02-02T11:39:36Z DDEBUG Cleaning up.
2022-02-02T11:39:36Z SUBDEBUG
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 573, in load
ret = self._repo.load()
File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 394, in load
return _repo.Repo_load(self)
RuntimeError: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]

CentOS Linux 8 had reached the End Of Life (EOL) on December 31st, 2021. It means that CentOS 8 will no longer receive development resources from the official CentOS project. After Dec 31st, 2021, if you need to update your CentOS, you need to change the mirrors to vault.centos.org where they will be archived permanently. Alternatively, you may want to upgrade to CentOS Stream.

Bước 1: Đi tới thư mục /etc/yum.repos.d/

[root@vinastar ~]# cd /etc/yum.repos.d/

Bước 2: Thực hiện 2 command sau để điều chỉnh file cấu hình

[root@vinastar ~]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@vinastar ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

Bước 3: Thực hiện thao tác yum update

[root@vinastar ~]# yum update -y

Kết quả:

2022 03 28 210619
Xử lý lỗi khi yum trên CentOS 8 – Failed to download metadata for repo ‘AppStream’ 3

Chúc Quý khách thành công

Was This Article Helpful?

0
0 Comments

There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *