centos6 yum 安装 install c++4.8 gcc4.8

cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo 
yum --enablerepo=testing-1.1-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++


This will install it most likely into /opt/centos/devtoolset-1.1/root/usr/bin/

Then you can tell your compile process to use the gcc 4.7 instead of 4.4 with the CC variable

export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc  
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++


For g++ 4.8.2, change 1.1 to 2 everywhere, and change --enablerepo=testing-1.1-devtools-6 to--enablerepo=testing-devtools-2-centos-6



There is new version of devtoolset 2.0. Nice people from Cern working on Scientific Linux createdan open version:

If you use CentOS (not Scientific Linux), then you will have to import their GPG key from here using:

rpm --import http://www.scientificlinux.org/documentation/gpg/RPM-GPG-KEY-cern

Enjoy!

EL6 gcc-4.8 http://www.hop5.in/yum/el6/repoview/gcc.html

or this

http://puias.princeton.edu/data/puias/DevToolset/6/x86_64/ /etc/yum.repos.d/DevToolset.repo

[DevToolset-2]
name=RedHat DevToolset v2 $releasever - $basearch
baseurl=http://people.centos.org/tru/devtools-2/$basearch/
enabled=1
gpgcheck=0

Testing run

# yum install devtoolset-2-gcc-4.8.2 devtoolset-2-gcc-c++-4.8.2
# /opt/rh/devtoolset-2/root/usr/bin/gcc --version

export 做好软链接

ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r
gcc --version
原文地址:https://www.cnblogs.com/youlechang123/p/4809976.html