您好,登錄后才能下訂單哦!
這篇文章主要介紹“安裝linux redhat后無法使用yum命令安裝gcc-c++怎么解決”的相關知識,小編通過實際案例向大家展示操作過程,操作方法簡單快捷,實用性強,希望這篇“安裝linux redhat后無法使用yum命令安裝gcc-c++怎么解決”文章能幫助大家解決問題。
問題:
[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 ........ ........ 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
關于“安裝linux redhat后無法使用yum命令安裝gcc-c++怎么解決”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識,可以關注億速云行業資訊頻道,小編每天都會為大家更新不同的知識點。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。