Press "Enter" to skip to content

centos8 执行 yum update 报错

新装了centos8,执行yum update 报错:

[root@MikroTik /]# yum update -y
Failed to set locale, defaulting to C.UTF-8
CentOS Linux 8 - AppStream                                                                                                                                        0.0  B/s |   0  B     00:00    
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=container [Could not resolve host: mirrorlist.centos.org]
Error: 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&re
po=AppStream&infra=container [Could not resolve host: mirrorlist.centos.org]

原因:centOS Linux 8 官方宣布于2021.12.31开始停止维护,延期到2022.1.31执行完毕。老的镜像将移到vault.centos.org。所以,以上报错是由于CentOS 8 EOS 将CentOS 8 Mirror 站点转换为Vault 并且找不到Mirror 站点而出现的问题。

执行以下脚本更换镜像源:

#!/bin/bash

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

原文链接:https://blog.csdn.net/dianxin113/article/details/125752307

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注