0%

解决CentOS执行yum操作报错Could not retrieve mirrorlist

一、问题说明:

在CentOS7环境下执行yum操作安装软件包时出现如下报错:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
12: Timeout on http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
二、解决方法:

修改/etc/resolv.conf配置文件后重启网络

[root@localhost ~]# vim /etc/resolv.conf
# Generated by NetworkManager
# nameserver 192.168.43.1
nameserver 8.8.8.8
search localdomain
[root@localhost ~]# service network restart

然后正常安装

[root@localhost ~]# yum -y install wget
已加载插件:fastestmirror
base                                    | 3.6 kB     00:00     
extras                                  | 2.9 kB     00:00     
updates                                 | 2.9 kB     00:00     
(1/4): base/7/x86_64/group_gz             | 153 kB   00:01     
(2/4): extras/7/x86_64/primary_db         | 194 kB   00:02     
(3/4): updates/7/x86_64/primary_db        | 1.3 MB   00:05     
(4/4): base/7/x86_64/primary_db           | 6.1 MB   00:17  
......