如何配置Linux CentOS 7以解决无法解析镜像源的问题?

摘要:转载自:https:www.jb51.netserver345687zyo.htm解决yum安装工具时提示以下错误信息已加载插件:fastestmirror, langpacksLoading mirror speeds from

转载自:https://www.jb51.net/server/345687zyo.htm

解决yum安装工具时提示以下错误信息

已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock  error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"

首先确保虚拟机网络畅通

ping www.baicu.com

备份系统自带yum源配置文件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.back

通过curl下载yum源

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

运行yum makecache生成缓存

yum makecache

更新yum源,等待完成即可使用yum下载命令

yum -y update