CentOS6.5升级GCC/G++到4.8.2

CentOS6.5自带的GCC/G++的版本为4.4.7,不支持C++11标准,也不能经过yum update命令更新GCC/G++的版本。
手动更新GCC/G++的步骤以下:
一、若有必要请先执行命令安装开发工具 yum groupinstall "Development tools"
二、卸载安装的GCC: yum remove gcc
三、使用devtools-2的repo来安装GCC
cd /etc/yum.repos.d
wget https://people.centos.org/tru/devtools-2/devtools-2.repo
yum --enablerepo=testing-devtools-2-centos-6 install devtoolset-2-gcc devtoolset-2-gcc-c++
yum --enablerepo=testing-devtools-2-centos-6 install devtoolset-2-binutils devtoolset-2-gcc-gfortran
注:不安装devtoolset-2-binutils devtoolset-2-gcc-gfortran,可能会出现错误:Error: expecting string instruction after `rep'
四、替换系统中原来的GCC
经过前面的步骤把GCC安装到如下目录:
/opt/rh/devtoolset-2/root/usr/bin
接下来须要修改系统的配置,使默认的 gcc 和 g++ 命令使用的是新安装的版本,批量创建软链接。
ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
五、验证
[root@localhost ~]# g++ --version
g++ (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.
六、能够使用devtools-1.1升级到gcc 4.7.2html

参考文档:https://blog.csdn.net/muyue_8710/article/details/53335763c++

CentOS65上利用源码安装GCC参考:https://teddysun.com/432.htmlcentos