腾讯云主机安装的是gcc 4.8.5:  目标:升级至gcc 7.3版本: root用户下执行:
[root@VM-4-17-centos boost]# yum -y install centos-release-scl
[root@VM-4-17-centos boost]# yum install devtoolset-7-gcc*
 执行成功后,查找刚刚安装的gcc:find / -name gcc  可以看到刚刚安装的gcc都在/opt/rh/devtoolset-7/root/usr/bin 目录下 将原来的/usr/bin/gcc 备份一下,创建软链接到我们刚刚安装的gcc 7上: 
[root@VM-4-17-centos boost]# mv /usr/bin/gcc /usr/bin/gcc-4.8
[root@VM-4-17-centos boost]# mv /usr/bin/g++ /usr/bin/g++-4.8
[root@VM-4-17-centos boost]# ln -s /opt/rh/devtoolset-7/root/usr/bin/gcc /usr/bin/gcc
[root@VM-4-17-centos boost]# ln -s /opt/rh/devtoolset-7/root/usr/bin/g++ /usr/bin/g++
[root@VM-4-17-centos boost]# mv /usr/bin/cc /usr/bin/cc-4.8
[root@VM-4-17-centos boost]# mv /usr/bin/c++ /usr/bin/c++-4.8
[root@VM-4-17-centos boost]# ln -s /usr/bin/gcc /usr/bin/cc
[root@VM-4-17-centos boost]# ln -s /usr/bin/g++ /usr/bin/c++
[root@VM-4-17-centos boost]# gcc --version
升级完成。
|