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

Answer from Karl Tarbet on Stack Overflow
Discussions

rhel8 - How to Install devtoolset 8 in RHEL 8 image - Stack Overflow
Please help me to install dev toolset-8 in rhel 8 image. i have pulled the base image as below . I want to install devtoolset-8. is there any other way please let me know. sudo docker pull registry. More on stackoverflow.com
🌐 stackoverflow.com
Support build using devtoolset-8 on CentOS 7
We need to support building the code without using Linuxbrew, by just using devtoolset-8. This will create binaries that are tied to the system version of glibc, so they won't be as portable, b... More on github.com
🌐 github.com
5
July 7, 2020
Use devtoolset-8 on Centos/RHEL for Node.js 14+
Requires access to the release machines. Install devtoolset-8 on the Centos/RHEL machines and use it to build releases for Node.js 14+. Refs: #2168 Install devtoolset-8 on centos7: release-osuosl-c... More on github.com
🌐 github.com
34
March 22, 2020
linux - Can not find required gcc version after devtoolset installation - Stack Overflow
I am using Centos 7 with kernel 3.10.0 My current gcc version is 4.8.5 and I am trying to install gcc 7 or later versions. I have followed instructions from How to install GCC/G++ 8 on CentOS When ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Softwarecollections
softwarecollections.org › en › scls › rhscl › devtoolset-8
Developer Toolset 8 — Software Collections
devtoolset-8 - Developer Toolset is designed for developers working on CentOS or Red Hat Enterprise Linux platform.
🌐
YouTube
youtube.com › hrishikesh nagargoje
How to Install Devtoolset-8 on Linux | How to upgrade GCC in Linux - YouTube
Upgrade GCC version 4.8.5 to 8.3.1 steps Install Commands:# 1. Install a package with repository for your system:# On CentOS, install package centos-release...
Published   August 11, 2021
Views   648
🌐
Red Hat
access.redhat.com › solutions › 4402111
How to install devtoolset-8 ? - Red Hat Customer Portal
June 14, 2024 - Where to find the devtoolset-8? where to find the devtoolset-8-toolchain? Red Hat Enterprise Linux 7. Software Collections. A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more. Log in for full access Log In · Learn more about Red Hat subscriptions ·
🌐
GitHub
github.com › yugabyte › yugabyte-db › issues › 4996
Support build using devtoolset-8 on CentOS 7 · Issue #4996 · yugabyte/yugabyte-db
July 7, 2020 - We need to support building the code without using Linuxbrew, by just using devtoolset-8. This will create binaries that are tied to the system version of glibc, so they won't be as portable, but this configuration is a good step towards...
Author   yugabyte
🌐
Red Hat
developers.redhat.com › blog › 2019 › 06 › 20 › developer-toolset-8-1-and-gcc-8-3-now-available-for-red-hat-enterprise-linux-7
Developer Toolset 8.1 and GCC 8.3 now available for Red Hat Enterprise Linux 7 | Red Hat Developer
March 28, 2023 - GDB 8.2 · binutils 2.30 · elfutils 0.176 · Valgrind 3.14.0 · Package name: devtoolset-8 · Container image: rhscl/devtoolset-8-toolchain-rhel7; rhscl/devtoolset-8-perftools-rhel7 · System support: RHEL 7 for x86_64, IBM Z, aarch64, ppc64le ·
Find elsewhere
🌐
GitHub
github.com › nodejs › build › issues › 2242
Use devtoolset-8 on Centos/RHEL for Node.js 14+ · Issue #2242 · nodejs/build
March 22, 2020 - Requires access to the release machines. Install devtoolset-8 on the Centos/RHEL machines and use it to build releases for Node.js 14+. Refs: #2168 Install devtoolset-8 on centos7: release-osuosl-centos7-ppc64_le-1 test-osuosl-centos7-pp...
Author   nodejs
🌐
Red Hat
access.redhat.com › solutions › 5737761
Where are the devtoolset packages in Red Hat Enterprise Linux 8 - Red Hat Customer Portal
RHEL 8 does not have devtoolset packages available There is no Software Collections repository for RHEL 8 to access devtoolset packages
🌐
Abysm
blog.abysm.org › 2016 › 03 › installing-developer-toolset-rhel-based-distributions
Installing Developer Toolset on RHEL-based Distributions · Kuan-Yi Li's Blog
March 25, 2016 - yum install devtoolset-8 · yum install devtoolset-7 · yum install devtoolset-6 · yum install devtoolset-4 · yum install devtoolset-3 · Say you want to use Developer Toolset 8, you can run · scl enable devtoolset-10 bash · to invoke a BASH shell with environment variables setup to run Developer Toolset 10, check it yourself with ·
🌐
Linux @ CERN
linux.web.cern.ch › devtoolset
Developer Toolset - Linux @ CERN
wget -O /etc/yum.repos.d/slc5-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc5-devtoolset.repo
🌐
Stack Overflow
stackoverflow.com › questions › tagged › devtoolset
Recently Active 'devtoolset' Questions - Stack Overflow
I run Centos 7, and I installed devtoolset-8 in order to get gcc 8. Here I found how to enable it for bash, which is done simply by adding source scl_source enable devtoolset-8 to .bashrc.
🌐
Red Hat
access.redhat.com › discussions › 4351781
Red Hat Customer Portal - Access to 24x7 support and knowledge
Hello! Am trying to download gcc 8.2 for rhel 7.7 using the url below, https://developers.redhat.com/products/developertoolset/hello-world#fndtn-windows · keep getting error message "No package devtoolset-8 available.
🌐
GitHub
github.com › actions › virtual-environments › discussions › 3459
GCC versions side-by-by-side support on Ubuntu images · actions/runner-images · Discussion #3459
May 26, 2021 - On Ubuntu 18.04, which ships libstdc++ 8, they taint the environment in a similar fashion (by depending on non-supported libstdc++ 9+). They only work properly with Ubuntu 20.04, as Ubuntu 20.04 ships libstdc++ 10. Due to my prior experience with RHEL devtoolset, I have also assumed that Ubuntu maintainers would backport toolchain while maintaining binary compatibility with base OS, and that they are just "still working" on GCC 11.
Author   actions
Top answer
1 of 5
93

In your ~/.bashrc or ~/.bash_profile Simply source the "enable" script provided with the devtoolset. For example, with the Devtoolset 2, the command is:

source /opt/rh/devtoolset-2/enable

or

source scl_source enable devtoolset-2

Lot more efficient: no forkbomb, no tricky shell

2 of 5
17

An alternative of source /opt/rh/devtoolset-4/enable is

source scl_source enable devtoolset-4

The above shell script scl_source is more elegant than using a hard coded path (may be different on another machine). However scl_source does less because /opt/rh/devtoolset-4/enable uses scl_source and other stuff.

To use scl_source you may have to upgrade package scl-utils

yum update scl-utils  # old scl-utils versions miss scl_source

Quick copy-paste

echo 'source scl_source enable devtoolset-4' >> ~/.bashrc
    # Do not forget to change the version ↑

Source code for curious people

An example of scl_source source code:
https://gist.github.com/bkabrda/6435016

The scl_source installed on my Red Hat 7.1

#!/bin/bash

_scl_source_help="Usage: source scl_source <action> [<collection> ...]

Don't use this script outside of SCL scriptlets!

Options:
    -h, --help    display this help and exit"

if [ $# -eq 0 -o $1 = "-h" -o $1 = "--help" ]; then
    echo "$_scl_source_help"
    return 0
fi


if [ -z "$_recursion" ]; then
    _recursion="false"
fi
if [ -z "$_scl_scriptlet_name" ]; then
    # The only allowed action in the case of recursion is the same
    # as was the original
    _scl_scriptlet_name=$1
fi
shift 1

if [ -z "$_scl_dir" ]; then
    # No need to re-define the directory twice
    _scl_dir=/etc/scl/conf
    if [ ! -e $_scl_dir ]; then
        _scl_dir=/etc/scl/prefixes
    fi
fi

for arg in "$@"; do
    _scl_prefix_file=$_scl_dir/$arg
    _scl_prefix=`cat $_scl_prefix_file 2> /dev/null`
    if [ $? -ne 0 ]; then
        echo "Can't read $_scl_prefix_file, $arg is probably not installed."
        return 1
    fi

    # First check if the collection is already in the list
    # of collections to be enabled
    for scl in ${_scls[@]}; do
        if [ $arg == $scl ]; then
            continue 2
        fi
    done

    # Now check if the collection isn't already enabled
    /usr/bin/scl_enabled $arg > /dev/null 2> /dev/null
    if [ $? -ne 0 ]; then
        _scls+=($arg)
        _scl_prefixes+=($_scl_prefix)
    fi;
done

if [ $_recursion == "false" ]; then
    _i=0
    _recursion="true"
    while [ $_i -lt ${#_scls[@]} ]; do
        _scl_scriptlet_path="${_scl_prefixes[$_i]}/${_scls[$_i]}/${_scl_scriptlet_name}"
        source "$_scl_scriptlet_path"
        if [ $? -ne 0 ]; then
            echo "Can't source $_scl_scriptlet_name, skipping."
        else
            export X_SCLS="${_scls[$_i]} $X_SCLS"
        fi;
        _i=$(($_i+1))
    done
    _scls=()
    _scl_prefixes=()
    _scl_scriptlet_name=""
    _recursion="false"
fi