關於安裝linux redhat後無法使用yum命令安裝gcc-c++問題,yumgcc-c

來源:互聯網
上載者:User

關於安裝linux redhat後無法使用yum命令安裝gcc-c++問題,yumgcc-c

[參考]:http://www.cnblogs.com/sunjiguang/p/5970217.html

[參考]:http://www.openskill.cn/article/126

初入職場,給linux redhat安裝環境的時候,遇到這麼個問題

[root@localhost ~]# yum -y install gccLoaded plugins: katello, product-id, security, subscription-managerUpdating certificate-based repositories.Unable to read consumer identitySetting up Install ProcessNo 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.repoResolving mirrors.163.com... 123.58.173.186,123.58.173.185Connecting to mirrors.163.com|123.58.173.186|:80...connected.HTTP request sent, awaiting response... 200 OKLength: 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 allLoaded plugins: katello, product-id, security, subscription-managerUpdating certificate-based repositories.Unable to read consumer identityCleaning up Everything

4.擷取yum列表

[root@localhost yum.repos.d]# yum makecacheLoaded plugins: katello, product-id, security, subscription-managerUpdating certificate-based repositories.Unable to read consumer identityaddons                                                                                                 | 1.9 kB     00:00     addons/filelists_db                                                                                    |  570 B     00:00     ................base                                                                                                                3667/3667base                                                                                                                3667/3667base                                                                                                                3667/3667Metadata 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 GCCgcc-gfortran.x86_64 : Fortran 95 supportgcc-gnat.x86_64 : Ada 95 support for GCCgcc-java.x86_64 : Java support for GCCgcc-objc++.x86_64 : Objective-C++ support for GCCgcc-objc.x86_64 : Objective-C support for GCCgcc44.x86_64 : GNU Compiler Collection version 4.4gcc44-c++.x86_64 : C++ support for GCC version 4.4gcc44-gfortran.x86_64 : Fortran support for GCC 4.4

6.安裝gcc

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

至此,gcc安裝完成,並且對於其他的編譯環境也可以使用yum安裝了

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.