安装linuxredhat后无法使用yum命令安装gcc-c++怎么解决

这篇文章主要介绍“安装linux redhat后无法使用yum命令安装gcc-c++怎么解决”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“安装linux redhat后无法使用yum命令安装gcc-c++怎么解决”文章能帮助大家解决问题。

成都创新互联是一家专注于成都网站建设、网站设计与策划设计,滨江网站建设哪家好?成都创新互联做网站,专注于网站建设十年,网设计领域的专业建站公司;建站业务涵盖:滨江等地区。滨江做网站价格咨询:028-86922220

问题:

[root@localhost ~]# yum -y install gcc
loaded plugins: katello, product-id, security, subscription-manager
updating certificate-based repositories.
unable to read consumer identity
setting up install process
no package gcc available.
nothing to do

对于习惯使用centos的人来说,不能使用这个命令,简直是种折磨

解决过程:

1.给linux redhat安装centos镜像

[root@localhost~]# wget http://mirrors.163.com/.help/centos6-base-163.repo
--2015-10-09 14:33:10-- http://mirrors.163.com/.help/centos6-base-163.repo
resolving mirrors.163.com... 123.58.173.186,123.58.173.185
connecting to mirrors.163.com|123.58.173.186|:80...connected.
http request sent, awaiting response... 200 ok
length: 2341 (2.3k) [application/octet-stream]
saving to: `centos6-base-163.repo'
100%2,341    --.-k/s  in 0s   
2015-10-09 14:33:22 (108 mb/s) -`centos6-base-163.repo' saved [2341/2341]

2.修改repo文件

[root@localhost~]# mv centos6-base-163.repo /etc/yum.repos.d/
*** 把$releasever替换成6
[root@localhost yum.repos.d]# sed -i 's#$releasever#6#g' ./centos6-base-163.repo

3.清除所有缓存

[root@localhost yum.repos.d]# yum clean all
loaded plugins: katello, product-id, security, subscription-manager
updating certificate-based repositories.
unable to read consumer identity
cleaning up everything

4.获取yum列表

[root@localhost yum.repos.d]# yum makecache
loaded plugins: katello, product-id, security, subscription-manager
updating certificate-based repositories.
unable to read consumer identity
addons                                                 | 1.9 kb   00:00   
addons/filelists_db                                          | 570 b   00:00   
........
........
base                                                        3667/3667
base                                                        3667/3667
base                                                        3667/3667
metadata cache created

5.搜索安装

[root@localhost ~]# yum search gcc |grep --color '^gcc'
gcc.x86_64 : various compilers (c, c++, objective-c, java, ...)
gcc-c++.x86_64 : c++ support for gcc
gcc-gfortran.x86_64 : fortran 95 support
gcc-gnat.x86_64 : ada 95 support for gcc
gcc-java.x86_64 : java support for gcc
gcc-objc++.x86_64 : objective-c++ support for gcc
gcc-objc.x86_64 : objective-c support for gcc
gcc44.x86_64 : gnu compiler collection version 4.4
gcc44-c++.x86_64 : c++ support for gcc version 4.4
gcc44-gfortran.x86_64 : fortran support for gcc 4.4

6.安装gcc

[root@localhost yum.repos.d]# yum -y install gcc

关于“安装linux redhat后无法使用yum命令安装gcc-c++怎么解决”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注创新互联行业资讯频道,小编每天都会为大家更新不同的知识点。

分享文章:安装linuxredhat后无法使用yum命令安装gcc-c++怎么解决
本文链接:https://www.cdcxhl.com/article12/gsghgc.html

成都网站建设公司_创新互联,为您提供网站设计定制开发云服务器自适应网站企业网站制作网站导航

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都seo排名网站优化