Compile source
[root@liqiang.io]# wget https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz
[root@liqiang.io]# tar zxf gcc-9.2.0.tar.gz && cd gcc-9.2.0
[root@liqiang.io]# ./contrib/download_prerequisites
[root@liqiang.io]# ./configure --disable-multilib # Important,Ignore 32 bit process
[root@liqiang.io]# make -j 8 # It will take long time, I don't how long actually, just put it aside
[root@liqiang.io]# make install
Rm old version
[root@liqiang.io]# rm -f /usr/bin/gcc
[root@liqiang.io]# rm -f /usr/bin/g++
[root@liqiang.io]# unlink /usr/lib64/libstdc++.so.6
Link new version
[root@liqiang.io]# ln -s /usr/local/gcc9/bin/gcc /usr/bin/gcc
[root@liqiang.io]# ln -s /usr/local/gcc9/bin/g++ /usr/bin/g++
[root@liqiang.io]# ln -s /usr/local/lib64/libstdc++.so.6.0.27 /usr/lib64/libstdc++.so.6
Ref