[root@localhost src]# wget http://people.centos.org/tru/devtools-2/devtools-2.repo[root@localhost src]# mv devtools-2.repo /etc/yum.repos.d/[root@localhost src]# yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
三个安装包会被装在 /opt/rh/devtoolset-2/root/ 中
更新软连接:
[root@localhost bin]# mv /usr/bin/gcc /usr/bin/gcc-4.4.7[root@localhost bin]# mv /usr/bin/g++ /usr/bin/g++-4.4.7[root@localhost bin]# mv /usr/bin/c++ /usr/bin/c++-4.4.7[root@localhost bin]# ln -s /opt/rh/devtoolset-2/root/usr/bin/gcc /usr/bin/gcc[root@localhost bin]# ln -s /opt/rh/devtoolset-2/root/usr/bin/c++ /usr/bin/c++[root@localhost bin]# ln -s /opt/rh/devtoolset-2/root/usr/bin/g++ /usr/bin/g++[root@localhost bin]# gcc --versiongcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)Copyright (C) 2013 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.