1. Preparations
yum install wget yum install make yum -y install bzip2 yum install m4 yum install gcc gcc-c++ glibc-static -y //Install the old gcc-related compilation tools
2. Download gcc 4.8.2 source code
wget http://gcc.gnu.org/pub/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2
3. Unzip the source code package, enter the gcc-4.8.2 directory, and execute the ./contrib/download_prerequisities script to automatically download the three dependent libraries: gmp-4.3.2, mpfr-2.4.2, mpc-0.8.1
4. Install gmp, mpfr, mpc
cd gmp mkdir build cd build ../configure --prefix=/usr/local/gcc/gmp-4.3.2 make && make install
cd ../../mpfr mkdir build cd build ../configure --prefix=/usr/local/gcc/mpfr-2.4.2 --with-gmp=/usr/local/gcc/gmp-4.3.2 make && make install
cd ../../mpc mkdir build cd build ../configure --prefix=/usr/local/gcc/mpc-0.8.1 --with-mpfr=/usr/local/gcc/mpfr-2.4.2 --with-gmp=/usr/local/gcc/gmp-4.3.2 make && make install