centos 6 使用SCL源安装gcc 4.9.2或更高版本
The Software Collections ( SCL ) Repository
参考:https://wiki.centos.org/AdditionalResources/Repositories/SCL
devtoolset-3 版本默认安装的是4.9.2,devtoolset-4 版本默认安装的是5.3版本,还可以往上类推。
CentOS 6/7 official support this. You don't need third party repository. And gcc version is 4.9.2 in CentOS's repo.
yum install centos-release-scl-rh
yum install devtoolset-3-gcc devtoolset-3-gcc-c++
To use the updated tools, start a new shell using the scl command:
scl enable devtoolset-3 bash
You may also need to reset your PATH environment variable, which might be set in ~/.bashrc or other profile file. If you need to change it, it should point to /opt/rh/devtoolset-3/root/usr/bin/:$PATH