关于安装linux redhat后无法使用yum命令安装gcc-c++问题的解决过程
初入职场,给linuxredhat安装环境的时候,遇到这么个问题
[root@localhost~]#yum-yinstallgcc Loadedplugins:katello,product-id,security,subscription-manager Updatingcertificate-basedrepositories. Unabletoreadconsumeridentity SettingupInstallProcess Nopackagegccavailable. Nothingtodo
对于习惯使用Centos的人来说,不能使用这个命令,简直是种折磨
解决过程:
1.给linuxredhat安装Centos镜像
[root@localhost~]#wgethttp://mirrors.163.com/.help/CentOS6-Base-163.repo --2015-10-0914:33:10--http://mirrors.163.com/.help/CentOS6-Base-163.repo Resolvingmirrors.163.com...123.58.173.186,123.58.173.185 Connectingtomirrors.163.com|123.58.173.186|:80...connected. HTTPrequestsent,awaitingresponse...200OK Length:2341(2.3K)[application/octet-stream] Savingto:`CentOS6-Base-163.repo' 100%2,341--.-K/sin0s 2015-10-0914:33:22(108MB/s)-`CentOS6-Base-163.repo'saved[2341/2341]
2.修改repo文件
[root@localhost~]#mvCentOS6-Base-163.repo/etc/yum.repos.d/ ***把$releasever替换成6 [root@localhostyum.repos.d]#sed-i's#$releasever#6#g'./CentOS6-Base-163.repo
3.清除所有缓存
[root@localhostyum.repos.d]#yumcleanall Loadedplugins:katello,product-id,security,subscription-manager Updatingcertificate-basedrepositories. Unabletoreadconsumeridentity CleaningupEverything
4.获取yum列表
[root@localhostyum.repos.d]#yummakecache Loadedplugins:katello,product-id,security,subscription-manager Updatingcertificate-basedrepositories. Unabletoreadconsumeridentity addons|1.9kB00:00 addons/filelists_db|570B00:00 ........ ........ base3667/3667 base3667/3667 base3667/3667 MetadataCacheCreated
5.搜索安装
[root@localhost~]#yumsearchgcc|grep--color'^gcc' gcc.x86_64:Variouscompilers(C,C++,Objective-C,Java,...) gcc-c++.x86_64:C++supportforGCC gcc-gfortran.x86_64:Fortran95support gcc-gnat.x86_64:Ada95supportforGCC gcc-java.x86_64:JavasupportforGCC gcc-objc++.x86_64:Objective-C++supportforGCC gcc-objc.x86_64:Objective-CsupportforGCC gcc44.x86_64:GNUCompilerCollectionversion4.4 gcc44-c++.x86_64:C++supportforGCCversion4.4 gcc44-gfortran.x86_64:FortransupportforGCC4.4
6.安装gcc
[root@localhostyum.repos.d]#yum-yinstallgcc
至此,gcc安装完成,并且对于其他的编译环境也可以使用yum安装了
总结
以上所述是小编给大家介绍的关于安装linuxredhat后无法使用yum命令安装gcc-c++问题的解决过程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!