CentOS7 中 出现 gcc:未找到命令 的处理办法

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/yueyekkx/article/details/81809005

1、linux中没有默认安装的gcc,通过yum发现没有可用软件包gcc

原因:这个系统没有注册到Red Hat订阅管理。你可以使用订阅管理器来注册,说白了就是要收费,不给钱不让用。。。。

2、查看系统版本:

百度red hat官方的rhel操作系统版本号与内核版本号的对应关系----CentOS 7

3、解决办法:

百度了很多,也试验了不少 ,教程都很乱。最后还是成功了,所以必须写下来。

不多抱怨,上干货!!!

在这非常感谢https://blog.csdn.net/jianm_liu/article/details/78316690  这篇文章的作者,代码可以从这边复制!!

更换CentOS的yum源,使用163的源(此方式要确定服务器能上网

1、看看原来的yum都有什么 

 

2、备份原yum,毕竟随意删除不是好习惯,万一这个方法不成功呢。。。

 

3、删除red hat yum源

4、再执行A步骤,看看是否删除了,不看也行

5、去http://mirrors.163.com/centos/7/os/x86_64/Packages/下载如下文件,至于放到哪自己记住就行

也可以直接命令下载  wget http://…….

6、安装新的yum 包

(1)

(2)

(3)

(4)

(5)

 

这里做点着重介绍。。。重点。。。。(包括出现的错误)

  1. 相互依赖的包要一起安装(上边第五步!)
  2. 有教程上没有说要下划红色箭头的那俩rpm,如果不安装的话会出现下边的问题。提示你要下载那俩!

 

3、--force --nodeps 的使用(自己百度为什么)

 7、现在的yum查看

 

 

8、将CentOS的yum源更新到red hat中
下载地址:http://mirrors.163.com/.help/centos.html

编辑文件内容  把版本号$releasever改为7,保存文件名为CentOS7-Base-163.repo,路径什么的对应好自己的。

然后把它放到/etc/yum.repos.d/下(mv也好  通过Xftp放也好)


 
 
  1. # CentOS-Base.repo
  2. #
  3. # The mirror system uses the connecting IP address of the client and the
  4. # update status of each mirror to pick mirrors that are updated to and
  5. # geographically close to the client. You should use this for CentOS updates
  6. # unless you are manually picking other mirrors.
  7. #
  8. # If the mirrorlist= does not work for you, as a fall back you can try the
  9. # remarked out baseurl= line instead.
  10. #
  11. #
  12. [base]
  13. name=CentOS -7-Base
  14. #mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os
  15. baseurl=http: //mirrors.163.com/centos/7/os/$basearch/
  16. gpgcheck= 1
  17. gpgkey=http: //mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
  18. #released updates
  19. [updates]
  20. name=CentOS -7-Updates
  21. #mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates
  22. baseurl=http: //mirrors.163.com/centos/7/updates/$basearch/
  23. gpgcheck= 1
  24. gpgkey=http: //mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
  25. #additional packages that may be useful
  26. [extras]
  27. name=CentOS -7-Extras
  28. #mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras
  29. baseurl=http: //mirrors.163.com/centos/7/extras/$basearch/
  30. gpgcheck= 1
  31. gpgkey=http: //mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
  32. #additional packages that extend functionality of existing packages
  33. [centosplus]
  34. name=CentOS -7-Plus
  35. baseurl=http: //mirrors.163.com/centos/7/centosplus/$basearch/
  36. gpgcheck= 1
  37. enabled= 0
  38. gpgkey=http: //mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

 

 

 9、执行下边两部

 

10:最后就是安装gcc了,安装完验证 ,成功了

 

 

第一次写,写的不好,见谅。希望此贴能对你有所帮助!!

 

  • 12
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值