Download gcc source code from https://ftp.gnu.org/gnu/gcc/gcc-4.9.0/gcc-4.9.0.tar.gz
$ wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.0/gcc-4.9.0.tar.gz
Install dependencies
$ yum install gmp-devel mpfr-devel libmpc-devel -y
Build from source and install
$ tar -xvzf gcc-4.9.0.tar.gz
$ cd gcc-4.9.0
$ mkdir build && cd build
$ ../configure --prefix=/usr --enable-languages=c,c++ --disable-multilib
$ make -j$(nproc)
$ make install
Validate installation
$ gcc --version
gcc (GCC) 4.9.0
Copyright (C) 2014 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.