CentOS 6: Upgrade GCC to 5.3.1

 

Install CentOS SCL repo.

yum -y install centos-release-scl

 

Install the actual devtoolset4 (http://mirror.centos.org/centos/6/sclo/x86_64/rh/devtoolset-4/)

yum -y install devtoolset-4 devtoolset-4-libatomic-devel 

 

Swap to gcc 5.3.1 automatically.

Put this in your ~/.bashrc

CC=/opt/rh/devtoolset-4/root/usr/bin/gcc
CPP=/opt/rh/devtoolset-4/root/usr/bin/cpp
CXX=/opt/rh/devtoolset-4/root/usr/bin/g++ 
PATH=/opt/rh/devtoolset-4/root/usr/bin:$PATH

Now either re-login or use “source ~/.bashrc”
 

Swap to gcc 5.3.1 manually.
You can manually load the variables by typing

. /opt/rh/devtoolset-4/enable