您好,登錄后才能下訂單哦!
這篇文章主要為大家展示了“安裝linux redhat后無法使用yum命令安裝gcc-c++怎么辦”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“安裝linux redhat后無法使用yum命令安裝gcc-c++怎么辦”這篇文章吧。
初入職場,給linux redhat安裝環(huán)境的時候,遇到這么個問題
[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
對于習(xí)慣使用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
至此,gcc安裝完成,并且對于其他的編譯環(huán)境也可以使用yum安裝了
以上是“安裝linux redhat后無法使用yum命令安裝gcc-c++怎么辦”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。