Skip to content

CentOS 6.x install different version of gcc 4.8/4.9/5.2

gcc 4.8

cd /etc/yum.repos.d 
wget http://people.centos.org/tru/devtools-2/devtools-2.repo

yum install devtoolset-2-gcc 
yum install devtoolset-2-binutils 
yum install devtoolset-2-gcc-gfortran 
yum install devtoolset-2-gcc-c++
source /opt/rh/devtoolset-2/enable

gcc 4.9

yum install centos-release-scl-rh centos-release-scl
yum check-update
yum install devtoolset-3-gcc  devtoolset-3-gcc-c++
source /opt/rh/devtoolset-3/enable

gcc 5.2

yum install centos-release-scl-rh centos-release-scl
yum check-update
yum install devtoolset-4-gcc  devtoolset-4-gcc-c++
source /opt/rh/devtoolset-4/enable

reference

  • http://mirror.centos.org/centos/6/sclo

Disclaimer
  1. License under CC BY-NC 4.0
  2. Copyright issue feedback me#imzye.me, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Try my iOS App