在使用yum或dnf時,出現下面的錯誤
# yum install somepackage
CentOS Linux 8 - AppStream 61 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
CentOS Linux 8 - AppStream 61 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
主要是mirrorlist中的連結無效,把他註解即可
# cd /etc/yum.repos.d/
# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
再把baseurl 註解打開
# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
這樣就可以了
參考資料
[1] https://techglimpse.com/failed-metadata-repo-appstream-centos-8/