CentOS报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7arch=x86_64repo=osi...
最小化安裝的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?
百度了一下這個錯誤,發(fā)現(xiàn)報錯原因是“本機無法連接網(wǎng)絡的網(wǎng)絡設置”的原因。于是參照“How to Setup network on centos 7”這篇博文,配置了下DHPC,最終解決了這個error。
配置CentOS 7的網(wǎng)絡,步驟如下:
1.在終端中輸入以下命令,查看安裝在本機的網(wǎng)卡:
1 [root@localhost ~]# nmcli d 2 設備 類型 狀態(tài) 連接 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動態(tài)配置 或 靜態(tài)配置
????動態(tài)配置
? 依次將第6行和第17行替換為:
??BOOTPROTO=dhcp
? ONBOOT=yes
? 然后,通過鍵入以下命令重新啟動網(wǎng)絡服務:
[root@localhost network-scripts]# systemctl restart network?測試網(wǎng)絡是否成功
?
???靜態(tài)配置??
?依次將第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然后,通過鍵入以下命令重新啟動網(wǎng)絡服務:
[root@localhost network-scripts]# systemctl restart network?centos查詢本機的外網(wǎng)IP: curl?ifconfig.me?命令即可查看
?
?
?
?
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/leo2li/p/8275581.html
總結(jié)
以上是生活随笔為你收集整理的CentOS报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7arch=x86_64repo=osi...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: django博客项目7
- 下一篇: Codeforces 543 B. Wo