# 升级 查看当前gcc版本号: ```bash [gpadmin@bogon ~]$ gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) Copyright © 2015 Free Software Foundation, Inc. ``` 升级到gcc 9.3: ```bash [gpadmin@bogon ~]$ sudo yum -y install centos-release-scl [gpadmin@bogon ~]$ sudo yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils [gpadmin@bogon ~]$ scl enable devtoolset-9 bash ``` 查看升级后的gcc版本号: ```bash [gpadmin@bogon ~]$ scl enable devtoolset-9 bash [gpadmin@bogon ~]$ gcc --version gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) Copyright (C) 2019 Free Software Foundation, Inc. ``` 注:scl命令启用只是临时的,如果希望在新session中启用,可以这样: ```bash [gpadmin@bogon ~]$ echo "source /opt/rh/devtoolset-9/enable" >> ~/.bash_profile ``` # 参考 - [为CentOS 6、7升级gcc至4.8、4.9、5.2、6.3、7.3等高版本](https://www.vpser.net/manage/centos-6-upgrade-gcc.html)