Customize gcc version in CentOS
SCL (software collection) is a very handy tool to control the GCC version in CentOS.
Unfortunately, there currently no equivalent in Ubuntu. Here is how to switch GCC version in CentOS with SCL.
# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
# sudo yum install centos-release-scl
# sudo yum install devtoolset-9
# scl enable devtoolset-9 bash
# gcc --version
gcc (GCC) 9.1.1 20190605 (Red Hat 9.1.1-2)