Recently you need to use c++11, so you need to upgrade GCC from 4.4.7 to 4.8.1.
First we need to download the GCC source
wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.1/gcc-4.8.1.tar.gz
Then unzip into the directory
Tar-xvzf gcc-4.8.1.tar.gz-c/OPT/GCC
cd/opt/gcc/gcc-4.8.1
Execute the following command:
./contrib/download_prerequisites
Then create the compilation directory in the gcc-4.8.1 peer directory
CD..
mkdir build_gcc_4.8.1
The next step is to execute the compilation
CD build_gcc_4.8.1
... /gcc-4.8.1/configure--enable-checking=release--enable-languages=c,c++--disable-multilib
make-j4
make Install
If you do not encounter error while executing make and make install, congratulations, you have completed the gcc-4.8.1 installation.
The default installation path is:
/usr/local/bin
The next step is to upgrade the version.
/usr/sbin/update-alternatives--install /USR/BIN/GCC gcc/usr/local/bin/x86_64-unknown-linux-gnu-gcc-4.8.1 40
/usr/sbin/update-alternatives--install/usr/bin/g++ g++/usr/local/bin/g++ 40
Check your server's GCC version again to see that it has been updated to 4.8.1
But in fact in make and makes install process, more or less will encounter some inexplicable problems.
The problem I had was that I made a mistake in make, and I doubted if I had a problem with the installation package I downloaded.
Later, after you have made clean and deleted all of the build files, you're done again.
The only difference between the first failure and the second success is:
The second gcc-4.8.1 decompression is placed in the/opt/gcc/directory, followed by the build_gcc-4.8.1 is placed in the/OPT/GCC directory.
And the first time, decompression source gcc-4.8.1 and subsequent build_gcc-4.8.1 are placed in the/opt/root directory.