這篇文章主要介紹“安裝linux redhat后無法使用yum命令安裝gcc-c++怎么解決”的相關(guān)知識,小編通過實(shí)際案例向大家展示操作過程,操作方法簡單快捷,實(shí)用性強(qiáng),希望這篇“安裝linux redhat后無法使用yum命令安裝gcc-c++怎么解決”文章能幫助大家解決問題。
成都創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)與策劃設(shè)計(jì),濱江網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:濱江等地區(qū)。濱江做網(wǎng)站價格咨詢: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
對于習(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
關(guān)于“安裝linux redhat后無法使用yum命令安裝gcc-c++怎么解決”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,小編每天都會為大家更新不同的知識點(diǎn)。