1、今天在学习Linux过程中,执行yum list命令,然后系统报错,如下图显示:
已加载插件: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.
2、然后就打开文件:vim /etc/yum.repos.d/CentOS-Base.repo,改了一下镜像的地址,为了防止出问题,我是把之前的baseurl给注释掉的,没有删除,增加的四个部分如下图:
命令附上:
17行的: baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
26行的: baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
35行的:baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
44行的:baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
改好之后,按esc,然后按 :wq ,保存退出。
3、然后执行yum list,就执行成功了,问题解决,如下图: