栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > 服务器

关于安装linux redhat后无法使用yum命令安装gcc-c++问题的解决过程

服务器 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

关于安装linux redhat后无法使用yum命令安装gcc-c++问题的解决过程

初入职场,给linux redhat安装环境的时候,遇到这么个问题

[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   
........
........
base3667/3667
base3667/3667
base3667/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

至此,gcc安装完成,并且对于其他的编译环境也可以使用yum安装了

总结

以上所述是小编给大家介绍的关于安装linux redhat后无法使用yum命令安装gcc-c++问题的解决过程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对考高分网网站的支持!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/180760.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号