最小化安装的CentOS 7在运行yum安装命令时报了以下错误:

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

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

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

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

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

1 [root@localhost ~]# nmcli d
2 设备   类型      状态    连接
3 ens33  ethernet  连接的  ens33
4 lo     loopback  未托管  --

2.切换到/etc/sysconfig/network-scripts/目录下,打开“ifcfg-ens33”文件:

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

 1 [root@localhost network-scripts]# vi ifcfg-ens33
 2
 3 TYPE=Ethernet
 4 PROXY_METHOD=none
 5 BROWSER_ONLY=no
 6 BOOTPROTO=dhcp
 7 DEFROUTE=yes
 8 IPV4_FAILURE_FATAL=no
 9 IPV6INIT=yes
10 IPV6_AUTOCONF=yes
11 IPV6_DEFROUTE=yes
12 IPV6_FAILURE_FATAL=no
13 IPV6_ADDR_GEN_MODE=stable-privacy
14 NAME=ens33
15 UUID=c71a84d9-bbd2-445d-bac8-d53d545055e0
16 DEVICE=ens33
17 ONBOOT=yes
18 IPV6_PRIVACY=no

动态配置 或 静态配置

» 动态配置

依次将第6行和第17行替换为:

BOOTPROTO=dhcp
  ONBOOT=yes

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

[root@localhost network-scripts]# systemctl restart network

测试网络是否成功

 » 静态配置

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

BOOTPROTO=static
  ONBOOT=yes

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

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

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

[root@localhost network-scripts]# systemctl restart network

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

转载于:https://www.cnblogs.com/leo2li/p/8275581.html

CentOS报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7arch=x86_64repo=osi...相关推荐

  1. CentOS报错:“Could not resolve host: mirrorlist.centos.org; Unknown error“

    在电脑上安装了VMware Workstation Pro, 安装了一个虚拟机想要安装docker,在执行如下yum命令 [root@10 ~]# sudo yum install -y yum-ut ...

  2. vmware安装minimal centos报错/etc/rc5.d/s99local : line

    2019独角兽企业重金招聘Python工程师标准>>> 有人用vmware安装minimal centos报错/etc/rc5.d/s99local : line:25 : ejec ...

  3. windows 7 远程桌面连接centos报错,包括但不限于连接断开解决办法

    windows 7 远程桌面连接centos报错,包括但不限于连接断开 问题:使用windows7连接centos中的xrdp服务时会报错,错误内容包括:网络断开丢失连接,无法识别的函数标识等: 解决 ...

  4. flashftp连接虚拟机centos报错的解决方法

    flashftp连接虚拟机centos报错的解决方法 参考文章: (1)flashftp连接虚拟机centos报错的解决方法 (2)https://www.cnblogs.com/yjdcoder/p ...

  5. SAP IDoc Post不成功,报错 - Conventional invoice verification no longer maintained as of Release 4.6-

    SAP IDoc Post不成功,报错 - Conventional invoice verification no longer maintained as of Release 4.6- IDoc ...

  6. CentOS报错:removing mirrorlist with no valid mirrors: /var/cache/yum/i386/6/base/mirrorlist.txt

    参考文献:https://www.jianshu.com/p/26eaf53102e2 打算在Centos6上安装gcc,输入yum install gcc提示如下: Loaded plugins: ...

  7. CentOS报错:There are no enabled repos

    在使用yum安装软件的时候报了下面的错误: Loading mirror speeds from cached hostfile There are no enabled repos.Run &quo ...

  8. Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7arch=x86_64repo=osinfra=stoc...

    今天安装完带图形界面的CentOS 7后,在Terminal中运行yum安装命令时报了以下错误: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...

  9. kong 启动报错 could not retrieve server_version: timeout

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 报错: nginx: [error] init_by_lua error: /usr/local/s ...

最新文章

  1. java memcachedclient_Java memcached client怎样建立长连接
  2. python中文件读写位置的作用-Python中文件的读写
  3. 使用 Intel HAXM 为 Android 模拟器加速,媲美真机(转)
  4. Python入门100题 | 第011题
  5. 成功解决TypeError: unhashable type: 'numpy.ndarray'
  6. Oracle 学习笔记 14 -- 集合操作和高级子查询
  7. 电驴创始人Jed McCaleb的传奇人生
  8. 国产银河数学式电子计算机是属于,《世界上公认的第一台电子计算机.doc
  9. 网银支付 加密解密说明
  10. 另一个视角看春节红包大战,为什么说智能云是百度第二增长引擎
  11. TSINGSEE青犀视频云-边-端架构视频智能分析平台EasyNVR如何实现直播地址和录像地址统一
  12. Marvin is plain Jane WriteUp_实验吧_Crypto
  13. 【机房重构】一步一步往上爬——不仅仅是三层
  14. 电路及电路设计经验技巧大合集
  15. 简谈python正则表达式
  16. 新基建必看系列——一文看懂爆火的智慧灯杆未来趋势及竞争格局
  17. 搭档之家:刘强东章泽天共同成立企业管理公司,前者持股99%
  18. 企业微信可以转移好友吗?
  19. MT6737 Android N 平台 Audio系统学习----ALSA Driver
  20. USB HUB芯片 FE8.1替代方案

热门文章

  1. 1.9 编程基础之二分查找 13:整数去重 python
  2. mysql 连接 iOS_iOS连接mysql数据库及基本操作
  3. excel批量更改超链接_批量新建Excel指定名称工作表并设置超链接!你,学会了吗?...
  4. BootStrap笔记-按钮相关
  5. HTTP|Qt实践-Qt编写某平台刷评论软件(含代码与思路)
  6. Qt调用face++的http接口,实现人脸对比
  7. Qt文档阅读笔记-Qt Core的官方解析
  8. C++ opengl 绘制三角形带
  9. 尾气冒黑烟是什么问题_汽车排气管冒大量白烟?车肯定有问题
  10. 可消费消息数量_战疫情!CKafka助力腾讯课堂百万消息实现稳定互动