gcc 不同版本的安裝


系統環境centos 6.5

使用root用戶進行安裝,此方法會將gcc安裝至/usr/bin目錄下

curl -Lks http://www.hop5.in/yum/el6/hop5.repo > /etc/yum.repos.d/hop5.repo
yum install gcc gcc-g++ -y
  • 4.9.2
yum install centos-release-scl -y
yum install devtoolset-3-toolchain -y
scl enable devtoolset-3 bash
  • 5.2.1
yum install centos-release-scl -y
yum install devtoolset-4-toolchain -y
scl enable devtoolset-4 bash

Step1:Install the Software Collections tools

yum install scl-utils

Step2:Download a package with repository for your system.

# (See the Yum Repositories section below. You can use `wget URL`.)

請注意,這里下載的 rpm 是從 softwarecollection 里下載的repo倉庫,可以通過wget下載

Step3:Install the repo package

yum install rhscl-devtoolset-3-*.noarch.rpm

Step4:Install the collection

yum install devtoolset-3

這里建議只下載工具鏈,而不是所有devtoolset都全部下載,因為里面還帶有許多不需要的組建,具體下載內容參考上一節的表格。

Step4:Start using software collections

scl enable devtoolset-3 bash

卸載Devtoolset

可能大家用完開發工具集后就會想要刪除它,其實很簡單,輸入以下命令:

yum remove devtoolset-3\*

然后也可以刪除SCL管理工具

yum remove scl-utils\*

最后如果精神潔癖,還可以刪除掉SoftwareCollection這個repo倉庫RPM

rpm -qa | grep rhscl
rpm -e XXXXXXX

最近softwarecollection網站還將自己的倉庫rpm提交到了官方源中,這樣只需要鍵入

yum install centos-release-scl-rh

非常輕松的就能搞定倉庫的安裝,但是眾所周知,GFW城牆遠大,但是萬幸的是阿里雲鏡像已經提供了方便快捷的倉庫源,只不過我們需要手動改一改配置文件,下面就是應當修改的配置文件

# CentOS-SCLo-rh.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information

[centos-sclo-rh]
name=CentOS-$releasever - SCLo rh
# baseurl=http://mirror.centos.org/centos/$releasever/sclo/$basearch/rh/
baseurl=http://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-rh-testing]
name=CentOS-$releasever - SCLo rh Testing
baseurl=http://buildlogs.centos.org/centos/$releasever/sclo/$basearch/rh/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM