In order to get gcc 4.9 do below steps. (You cannot use gcc 4.9 with MPI programs.) Do not put below steps in your .bashrc or .bash_profile.
srun -p build --time=2:00:00 --mem=100G --pty /bin/bash
scl enable devtoolset-3 bash
Issue below command to verify that you have access to gcc 4.9:
Note that gfortran 4.9 is not available. Please see below link for newer version of gcc and gfortran: