yum出错:Could not resolve host: mirrors.cloud.aliyuncs.com

FANG -
yum出错:Could not resolve host: mirrors.cloud.aliyuncs.com

拉取了一个阿里云镜像后,使用yum时出现“Could not resolve host: mirrors.cloud.aliyuncs.com”错误,解决方法如下:
1、我的镜像是linux版本是8,改动上会比7有所区别。
2、cd /etc/yum.repos.d/,可以看到如下内容:

CentOS-Linux-AppStream.repo          CentOS-Linux-FastTrack.repo
CentOS-Linux-BaseOS.repo             CentOS-Linux-HighAvailability.repo
CentOS-Linux-ContinuousRelease.repo  CentOS-Linux-Media.repo
CentOS-Linux-Debuginfo.repo          CentOS-Linux-Plus.repo
CentOS-Linux-Devel.repo              CentOS-Linux-PowerTools.repo
CentOS-Linux-epel.repo               CentOS-Linux-Sources.repo
CentOS-Linux-Extras.repo             nginx.repo

此时需要修改

CentOS-Linux-AppStream.repo、
CentOS-Linux-BaseOS.repo、
CentOS-Linux-epel.repo、
CentOS-Linux-Extras.repo

四项内容中的yum源,将文件中所有的“http://mirrors.cloud.aliyuncs...”,改为“http://mirrors.aliyun.com”,如

baseurl=http://mirrors.aliyun.com/$contentdir/$releasever/BaseOS/$basearch/os/

/后面内容不要动,否则后期还会报错。

Linux8之前的应该没有“CentOS-Linux-AppStream.repo”文件,其他的名称应该也有区别,但不难找到。

3、改动之后执行两个命令:
yum clean all
yum makecache

之后执行yum命令应该就可以了。

特别申明:本文内容来源网络,版权归原作者所有,如有侵权请立即与我们联系(cy198701067573@163.com),我们将及时处理。

Tags 标签

yum后端linux

扩展阅读

加个好友,技术交流

1628738909466805.jpg