当前位置: 首页 > news >正文

亲测有效:虚拟机安装gcc,报错Could not retrieve mirrorlist http://mirrorlist.centos.org

(网卡配置资料)

原因:

        网络问题

报错详情:

 One of the configured repositories failed (未知),and yum doesn't have enough cached data to continue. At this point the onlysafe 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/etc. for the repository, to point to a workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Run the command with the repository temporarily disabledyum --disablerepo=<repoid> ...4. Disable the repository permanently, so yum won't use it by default. Yumwill then just ignore the repository until you permanently enable itagain or use --enablerepo for temporary usage:yum-config-manager --disable <repoid>orsubscription-manager repos --disable=<repoid>5. 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 muchslower). If it is a very temporary problem though, this is often a nicecompromise:yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=trueCannot find a valid baseurl for repo: base/7/x86_64

解决步骤:

1、修改虚拟机的网络连接模式为 NAT模式

2、右击桌面,打开终端

①首先查看网关配置文件名:

输入

ifconfig

②配置网卡信息:

vi /etc/sysconfig/network-scripts/ifcfg-ens32

 两种方法:

点击键盘 I ,开始输入

第一种:自动配置

1、BOOTPROTO=dhcp(自动获取ip)

2、ONBOOT=yes(设置开机自启动)

ESC--》:wq

在终端输入

 service network restart

重启网络服务 

ping www.baidu.com

查看网络是否通,如图

第二种:手动配置(之前配置有用的,但重新做了一遍,又不行了。把大体思路记录下吧)

①主机cmd,输入:

ipconfig

 找到所用的网的IP

BOOTPROTO= static (需手动配置) 

 ②

ESC--》:wq

在终端输入

 service network restart

重启网络服务 

ping www.baidu.com

查看网络是否通,如图

验证

安装gcc

yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automake

yum -y install wget httpd-tools vim

查看 gcc版本

gcc -v

输出以上信息,即为成功

http://www.lryc.cn/news/154695.html

相关文章:

  • 机器人中的数值优化(十二)——带约束优化问题简介、LP线性规划
  • 如何解决使用 ISPC 构建编译项目代码的时候出现_ISPCAlloc、_ISPCLaunch、_ISPCSync的连接器错误
  • Hadoop 集群一直处于安全模式,强制退出后出现数据丢失警告。解决方法
  • 四旋翼飞行器基本模型(MatlabSimulink)
  • P1116 车厢重组(冒泡排序)
  • Android逆向学习(番外一)smali2java部分文件无法反编译的bug与修复方法
  • go语言基本操作---三
  • ArcGIS Enterprise + ArcGIS Pro 常用服务类型发布
  • 优思学院|亲和图案例:寻找六西格玛的项目
  • tomcat 的缓存机制
  • laravel 压缩文件与解压文件
  • kind搭建k8s集群用于测试
  • 软件测试人需要掌握的测试知识架构体系(上)
  • QT数据库,实现数据库增删改查
  • SQL-子查询
  • 【8章】Spark编程基础(Python版)
  • 桌面应用小程序,一种创新的跨端开发方案
  • 将本地jar打包到本地maven仓库或maven私服仓库中
  • java 实现建造者模式
  • 串行FIR滤波器
  • Spring Boot 整合 Shiro(后端)
  • 面试中的自我介绍:首印象决定一切
  • 深入理解联邦学习——联邦学习的价值
  • linux 内存一致性
  • Vue 如何监听 localstorage的变化
  • ActiveMQ使用JDBC持久化消息
  • 光环云出席Enjoy出海AIGC主题研讨会,助力企业迎接AI时代机遇与挑战
  • 动态规划:路径和子数组问题(C++)
  • 微服务-gateway跨域配置
  • 爬虫项目(二):中国大学排名