CentOS 7 升级gcc至9.3
升级
查看当前gcc版本号:
- snippet.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:
- snippet.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版本号:
- snippet.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中启用,可以这样:
- snippet.bash
[gpadmin@bogon ~]$ echo "source /opt/rh/devtoolset-9/enable" >> ~/.bash_profile
参考
打赏作者以资鼓励: