How to install gcc8 using devtoolset-8-gcc

lordhog picture lordhog · Nov 15, 2018 · Viewed 11.4k times · Source

I am using CentOS Linux release 7.3.1611 which has gcc 4.8.5 20150623 installed. I am looking for a way to install a newer version of gcc, specially 8.1. I found the following site on how to install gcc v7 link 1 which describes how to install gcc v7 (using devtoolset-7-gcc*). I did follow the guidelines and was able to install gcc v7. Though, if I followed the same procedure, but used "devtoolset-8-gcc*" instead the return message states "No package devtoolset-8-gcc* available.".

Performed a search and found a page called "Information for build devtoolset-8-gcc-8.1.1-4.el6" link 2, but not sure how to install this. I believe I would need to download the rpm source, compile/build the source, then finally install it.

Basically, I am looking for a easy way to install gcc v8 just like using the method described on link 1.

Thanks in advance.

Answer

Karl Tarbet picture Karl Tarbet · Apr 27, 2019

To install the full tools-set including gfortran on centos 7:

yum install centos-release-scl
yum install devtoolset-8
scl enable devtoolset-8 -- bash

enable the tools:

source /opt/rh/devtoolset-8/enable 

you may wish to put the command above in .bash_profile

ref: https://unix.stackexchange.com/questions/477360/centos-7-gcc-8-installation