http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
时间: 2023-11-25 22:50:06 浏览: 233
报Could not retrieve mirrorlist http://mirrorlist.centos.org/解决办法
回答: 当执行yum -y install gcc命令时,出现了错误"Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was"。这个错误通常是由于网络连接问题导致的。可以尝试以下解决方法:首先,将yum源设置为阿里云,可以使用命令wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo来完成。然后,检查网络连接是否正常,可以使用命令ping www.baidu.com来测试。如果网络连接不正常,可以尝试修改DNS设置,找到文件/etc/sysconfig/network-scripts/ifcfg-ens33(注意ens33后面的数字是随机产生的),将其中的onboot改为yes,然后重新启动网络,使用命令service network restart,最后再次使用ping www.baidu.com来确认网络连接是否成功。如果网络连接正常,那么就可以正常执行yum -y install gcc命令了。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* *3* [Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stoc](https://blog.csdn.net/weixin_49114503/article/details/130324326)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=cont](https://blog.csdn.net/a2868221132/article/details/117261402)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文