Linux使用CentOS 7内核修改镜像源解决“Could not resolve host: mirrorlist.centos.org;未知的错误“问题

转载自: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

posted @ 2025-11-11 15:35  修电脑的  阅读(1)  评论(0)    收藏  举报