How to Install gcc 5.3 with yum on CentOS 7.2?

sunshine picture sunshine · Mar 31, 2016 · Viewed 140.8k times · Source

I am using CentOS 7.2

When I use yum groupinstall "Development Tools", gcc version is 4.8.5, like this:

enter image description here

I would like to install gcc 5.3

How to approach this with yum?

Answer

tesch1 picture tesch1 · Sep 27, 2016

Update:
Often people want the most recent version of gcc, and devtoolset is being kept up-to-date, so maybe you want devtoolset-N where N={4,5,6,7...}, check yum for the latest available on your system). Updated the cmds below for N=7.

There is a package for gcc-7.2.1 for devtoolset-7 as an example. First you need to enable the Software Collections, then it's available in devtoolset-7:

sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
scl enable devtoolset-7 bash
which gcc
gcc --version