cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
yum --enablerepo=testing-devtools-2-centos-6 install devtoolset-2-gcc devtoolset-2-gcc-c++
閫氳繃閫氳繃绗竴姝ヤ細鎶 GCC 瀹夎鍒颁互涓嬬洰褰曪細
/opt/rh/devtoolset-2/root/usr/bin
鎺ヤ笅鏉ラ渶瑕佷慨鏀圭郴缁熺殑閰嶇疆锛屼娇榛樿鐨 gcc 鍜 g++ 鍛戒护浣跨敤鐨勬槸鏂板畨瑁呯殑鐗堟湰銆
ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r
鐜板湪鏌ョ湅 g++ 鐨勭増鏈彿锛
#gcc --version
gcc (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 NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
鍙戣〃鍥炲