今天安装完带图形界面的CentOS 7后,在Terminal中运行yum安装命令时报了以下错误:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock32 error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
 
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
 
 1. Contact the upstream for the repository and get them to fix the problem.
 
 2. Reconfigure the baseurl/etcfor the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).
 
 3. Disable the repository, so yum won't use it by default. Yum will then
    just ignore the repository until you permanently enable it again or use
    --enablerepo for temporary usage:
 
        yum-config-manager --disable <repoid>
 
 4. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:
 
        yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

googel了一下这个错误,发现报错原因是“本机无法连接网络的网络设置”的原因。

于是参照“How to Setup network on centos 7”这篇博文,配置了下DHPC,最终解决了这个error。

配置CentOS 7的网络,步骤如下:

1.在终端中输入以下命令,查看安装在本机的网卡:

1
2
3
4
5
6
[xi@localhost ~]$ nmcli d//以下显示是已经配置到网络后的本机网络状况。
DEVICE       TYPE      STATE         CONNECTION 
virbr0       bridge    connected     virbr0     
eno16777736  ethernet  connected     eno16777736
virbr0-nic   ethernet  disconnected  --         
lo           loopback  unmanaged     -- 

2.GUI 或 命令模式的网络配置:

 GUI模式:

Step #1 » 在终端中输入以下命令,打开网络管理员。接着选择“Edit a connection”后按回车键(使用TAB键进行选择的选项)。

1
[xi@localhost ~]$ nmtui

Step  #2 » 现在你可以看到所有的网络接口,选择一个(我选择了“eno16777736”),然后点击“ Edit “。

Step 3 » 动态配置 或 静态配置

» 动态配置

1.在“IPv4 CONFIGURATION”配置选择“<Automatic>”;
   2.选择“Automatically connect”复选框;
   3.点击OK键,退出网络管理器。最后,通过键入以下命令重新启动网络服务。

1
[xi@localhost ~]$ systemctl restart network

现在你的服务器将从DHCP获得IP地址。

» 静态配置 

 1.在“IPv4 CONFIGURATION”配置选择”Manual”;
   2.添加与子网掩码,网关和DNS服务器(参见下图)的IP地址;
   3.选择“Automatically connect”复选框;
   4.点击OK键,退出网络管理器。现在,通过键入以下命令重新启动网络服务。

1
[xi@localhost ~]$ systemctl restart network

现在你的服务器具有静态IP。

命令模式:

Step #1 » 切换到/etc/sysconfig/network-scripts/目录下,打开“ifcfg-eno16777736”文件:

1
xi@localhost network-scripts]$ cd /etc/sysconfig/network-scripts/

      

1
[xi@localhost network-scripts]$ vim ifcfg-eno16777736

打开ifcfg-eno16777736文件,展开如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1  TYPE=Ethernet
2  BOOTPROTO=none
3  DEFROUTE=yes
4  IPV4_FAILURE_FATAL=no
5  IPV6INIT=yes
6  IPV6_AUTOCONF=yes
7  IPV6_DEFROUTE=yes
8  IPV6_FAILURE_FATAL=no
9  NAME=enp0s17
10 UUID=7f1aff2d-b154-4436-9497-e3a4dedddcef
11 ONBOOT=no
12 HWADDR=00:0C:29:A1:B5:D6
13 PEERDNS=yes
14 PEERROUTES=yes
15 IPV6_PEERDNS=yes
16 IPV6_PEERROUTES=yes

Step #3 » 动态配置 或 静态配置

» 动态配置

依次将第2行和第11行替换为:

BOOTPROTO=dhcp
  ONBOOT=yes

然后,通过键入以下命令重新启动网络服务:

1
[xi@localhost ~]$ systemctl restart network

连接外网,测试网络是否成功:

1
xi@localhost ~]$ ping www.baidu.com

» 静态配置

依次将第2行和第11行替换为:

BOOTPROTO=static
  ONBOOT=yes

然后,在文件末尾添加以下4行:

1
2
3
4
IPADDR=172.27.0.32
NETMASK=255.255.255.0
GATEWAY=172.27.0.1
DNS1=172.27.0.5

最后,通过键入以下命令重新启动网络服务:

1
[xi@localhost ~]$ systemctl restart network

现在你的服务器具有静态IP。

此外,你可以通过打开文件/ etc / sysconfig / network来修改主机名和DNS。

centos查询本机的外网输入 curl ifconfig.me 命令即可查看:

centos查询上网网关IP,tracepath www.baidu.com

1
2
3
4
HOSTNAME = server.krizna.com
DNS1 = 192.168.1.5
DNS2 = 8.8. 8.8
SEARCH = krizna.com  
 
 

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock32 error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"的更多相关文章

  1. CentOS报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock32 error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

    今天安装完带图形界面的CentOS 7后,在Terminal中运行yum安装命令时报了以下错误: Could not retrieve mirrorlist http://mirrorlist.cen ...

  2. yum 安装报错: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; Unknown error"

    [root@venn09 ~]# yum install -y vim Loaded plugins: fastestmirror Could not retrieve mirrorlist http ...

  3. Bug Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was

    yum -y install gcc 时候报bug: Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7& ...

  4. Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stoc

    今天在使用yum安装文件时,出现了以下问题: root@localhost opt]# yum update Loaded plugins: fastestmirror Could not retri ...

  5. Linux安装yum install gcc-c++出错: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...

    错误如图: 解决办法: 1.修改配置文件 /etc/resolv.conf,该配置文件如下: 2.输入:gedit resolv.conf,修改配置文件内容如下: 3.然后重启: 4.重新进行安装: ...

  6. 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"

    14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误" One of the configured ...

  7. yum安装软件报错:curl#6 - "Could not resolve host: mirrorlist.centos.org; Temporary failure in name resolut

    # yum install -y epel-release Loaded plugins: fastestmirror Repository base is listed more than once ...

  8. 安装时遇到:正在尝试其它镜像。 http://mirrors.btte.net/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.btte.net; 未知的错误"

    我出现这种错误是因为网络链接问题,因为我设置虚拟机网络链接为VmNET8,设置了nat模式,使得我本地机可以访问虚拟机的linux服务器.但是打开虚拟机的浏览器却不能上网了.所以现在我用xshell装 ...

  9. Could not resolve host: mirrorlist.centos.org Centos 7 Unkown error

    安装Centos7(core)以后,网卡默认不会启用.这是一个大坑,直接报错,这是一个过度优化,有几个开发人员/运维人员安装centos7(core)不用ssh去连接服务器的. 报错如下: Loade ...

随机推荐

  1. openLayers 3知识回顾

    openlayers 知识 前段时间帮助同事重构一个地图类的项目,然后就学习了openLayer3这个框架,但是官网上没有中文版,也没有详细的例子解释,我只能遇到看不懂的就翻译成中文来用,为了方便以后 ...

  2. 品阿里 Java 开发手册有感

    摘要: 原创出处 https://www.bysocket.com 「公众号:泥瓦匠BYSocket 」欢迎关注和转载,保留摘要,谢谢! 一个优秀的工程师和一个普通的工程师的区别,不是满天飞的架构图, ...

  3. 初学pyhon的几个练习小程序

    一.概述 此程序示例为博主根据路飞学城的python的作业而写的(博主也是python初学者,仅花了99元报了路飞学城的python入门14天集中营3期网络课堂班),此程序非常适合python初学者拿 ...

  4. Yii2设计模式——Yii2中用到哪些设计模式?

    "Yii2设计模式"包含了两个方面的内容:1.设计模式,2.Yii2框架. <设计模式>一书虽然以JAVA语言来表达设计模式的思想,但是设计模式远不限制于某一种特定的语 ...

  5. Odoo:全球第一免费开源ERP库龄表的简单实现方法(无需二开)

    问题背景 希望查看库龄超过30天的货物,该如何实现?此种简单数据查询需要二开吗? 解决方案 方法一:Stock Quant列表视图增加过滤器 <filter string="库龄超30 ...

  6. Ocelot + Consul + Registrator 基于Docker 实现服务发现、服务自动注册

    目录 1. Consul集群搭建 1.1 F&Q Consul官方推荐的host网络模式运行 2. Registrator服务注册工具 2.1 F&Q Registrator悬挂服务 ...

  7. 三星5.0以上设备最完美激活XPOSED框架的经验

    对于喜欢钻研手机的小伙伴来说,常常会接触到Xposed框架以及种类繁多功能强大的模块,对于5.0以下的系统版本,只要手机能获得Root权限,安装和激活Xposed框架是异常简易的,但随着系统版本的不断 ...

  8. 轻松学习UML之类图,状态图

    本文主要讲解UML图中的类图与状态图相关内容,如有不足之处,还请指正. 概述 统一建模语言(UML,UnifiedModelingLanguage)是面向对象软件的标准化建模语言,UML因其简单.统一 ...

  9. JS的正则表达式及回文

    function palindrome(str) { str = str.replace(/\s/g,"").replace(/[^a-zA-Z0-9]/g,"" ...

  10. Android串口开发

    参考资料: https://www.jianshu.com/p/9249ed03e745 GitHUb地址: https://github.com/AIlll/AndroidSerialPort An ...