Centos6.0 通过devtoolset-2工具安装gcc 4.8

详细步骤:

1、Save repository information as /etc/ yum .repos.d/slc6- devtoolset.repo on your system。then install it using yum

wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
yum install devtoolset-2

2、在安装过程中出现了错误:找不到相关的 GPG key,仅仅要依据提示安装对应的 GPG key 就可以

这一步最关键,14年2月份给出的下面密钥已经不可用。当前可用的例如以下:

rpm --import http://ftp.mirrorservice.org/sites/ftp.scientificlinux.org/linux/scientific/51/i386/RPM-GPG-KEYs/RPM-GPG-KEY-cern

这一步就是我写这篇博客的主要原因,可能你看到博文时这个GPG key已不可用,这时能够參考:
http://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos

3、又一次安装就可以

yum install devtoolset-2

4、export

ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r
gcc --version

备注:

须要參考的几个网址:

Developer Toolset

Scientific Linux

Install gcc 4.7 on Centos

RedHat Developer Toolset

原文地址:https://www.cnblogs.com/mfmdaoyou/p/6734917.html