yum install centos-release-scl-rh
yum install devtoolset-3-gcc devtoolset-3-gcc-c++
update-alternatives --install /usr/bin/gcc-4.9 gcc-4.9 /opt/rh/devtoolset-3/root/usr/bin/gcc 10
update-alternatives --install /usr/bin/g++-4.9 g++-4.9 /opt/rh/devtoolset-3/root/usr/bin/g++ 10
Answer from Lars Bilke on Stack Overflow
Top answer
1 of 4
22
yum install centos-release-scl-rh
yum install devtoolset-3-gcc devtoolset-3-gcc-c++
update-alternatives --install /usr/bin/gcc-4.9 gcc-4.9 /opt/rh/devtoolset-3/root/usr/bin/gcc 10
update-alternatives --install /usr/bin/g++-4.9 g++-4.9 /opt/rh/devtoolset-3/root/usr/bin/g++ 10
2 of 4
21

For installing the system compilers gcc, g++, the install command is # yum install gcc-c++ → Provides version 4.8.5 : /usr/bin/{ gcc, g++ }.

Other options: 1. gcc53-c++-5.3.0-1.el6.x86_64.rpm → https://drive.google.com/file/d/0B7S255p3kFXNRm9FVnZYUnhyZzg/view?usp=sharing&resourcekey=0-1N6zQa6Sbl_WycG1O9I7JA : Download and install : # cd Downloads/ && yum install ./gcc53-c++-5.3.0-1.el6.x86_64.rpm ..... Provides /usr/bin/{gcc53, g++53}.

  1. The devtoolset´s : https://www.softwarecollections.org/en/scls/rhscl/devtoolset-6/ → # yum-config-manager --enable rhel-server-rhscl-7-rpms

Install gcc, g++ version 4.9.2 : # yum install devtoolset-3-gcc-c++

Note : You can have as many gcc/g++ versions as you want, installed at the same time. ( The system compilers are a must.)


  1. gcc49-c++-4.9.3-1.el6.x86_64.rpm https://drive.google.com/file/d/1Pwq1ua80dGM72i7rpDNAIIdfcR1WK-hG/view?usp=sharing → Provides /usr/bin/{gcc49, g++49}.

  1. gcc63-c++-6.3.0-1.el7.x86_64.rpm https://drive.google.com/file/d/1t4WrgvpEP-6_NN3qMJhz9MS3CJhHrHKc/view?usp=sharing → Provides /usr/bin/{gcc63, g++63}.

  2. gcc45-c++-4.5.4-1.el7.x86_64.rpm https://drive.google.com/file/d/15aRg-BPhuyaEyZA9Jy-iAyC21_pwN7nD/view?usp=sharing → Provides /usr/bin/{gcc45, g++45, gfortran45}

  3. gcc42-c++-4.2.4-1.el6.x86_64.rpm https://drive.google.com/file/d/1eYWk6Nd63xeqqAUoJldNWRuwEGO6cAyv/view?usp=sharing → Provides /usr/bin/{gcc42, g++42}


  1. gcc73-c++-7.3.0-1.el7.x86_64.rpm https://drive.google.com/file/d/1PgwCP5tu8D0EJbJVTqJd7Vg8dJ4l4noi/view?usp=sharing → Provides /usr/bin/{gcc73, g++73}

  2. gcc48-c++-4.8.5-1.el6.x86_64.rpm https://drive.google.com/file/d/1w6fW6oSflDDYZt_cOpGj3QMEmzUC8Q9L/view?usp=sharing → Provides /usr/bin/{gcc48, g++48, gfortran48}

  3. gcc84-c++-8.4.0-1.el7.x86_64.rpm https://drive.google.com/file/d/1xgFtsiDi2uiB1B0AcOaSpxVizzET-pJf/view?usp=sharing → Provides /usr/bin/{gcc84, g++84, gfortran84}

Discussions

rhel - How to install gcc 9.X on RHEL8? - Unix & Linux Stack Exchange
I see from the documentation here that gcc has been updated on RHEL8, but what I haven't figured out is how to get it. The documentation indicates that there are now two streams, but I already hav... More on unix.stackexchange.com
🌐 unix.stackexchange.com
May 7, 2020
Installing GCC5.2.0 in RHEL 8.8
One possible solution is to install these dependencies manually, using the source code from the GCC infrastructure.. You can follow the instructions in this Stack Overflow answer to configure and build each dependency with static libraries, and then use them to compile GCC 5.2.0. https://stackoverflow.com/questions/9450394/how-to-install-gcc-piece-by-piece-with-gmp-mpfr-mpc-elf-without-shared-libra Kerem Çeliker More on reddit.com
🌐 r/redhat
7
2
December 21, 2023
software installation - install latest gcc on rhel 6 x86_64 - Unix & Linux Stack Exchange
I have an RHEL 6 server with gcc version 4.4.7. I wanted to update the gcc version (I think the current one is 4.8). Yum update doesn't work. Also, SO answers for a similar question on CentOS does ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
April 20, 2014
How do I install gcc from source on RHEL 7 (WITHOUT A SUBSCRIPTION!)?
I'm not knowledgeable in servers or this type of situation but it sounds to me that migration to another distro would be a good idea. If RHEL wants you to pay subscription to compile GCC then that's lame. Open source platforms should be restriction free and commercial support is what you should be paying for. For servers I hear that Centos, Opensuse, and Ubuntu are great, but like I said I'm not too knowledgeable in this area. I'm a Linux desktop user. That's my 2 cents anyway. More on reddit.com
🌐 r/linuxquestions
8
1
September 5, 2018
🌐
OneUptime
oneuptime.com › home › blog › how to install gcc and development tools on rhel
How to Install GCC and Development Tools on RHEL
March 4, 2026 - # Install the complete development toolchain sudo dnf group install -y "Development Tools" # This installs: # - gcc (C compiler) # - gcc-c++ (C++ compiler) # - make (build automation) # - automake, autoconf (build system generators) # - libtool ...
🌐
nixCraft
cyberciti.biz › nixcraft › howto › centos › centos / rhel 7: install gcc (c and c++ compiler) and development tools
CentOS / RHEL 7: Install GCC (C and C++ Compiler) and Development Tools - nixCraft
April 5, 2024 - Explains how to install GNU C, C++ compiler and other development tools on a CentOS and RHEL (Red Hat Enterprise Linux) version 7.x server/workstation.
🌐
ComputingForGeeks
computingforgeeks.com › home › install gcc and development tools on rhel 8 / centos 8
Install GCC and Development Tools on RHEL 8 / CentOS 8 [Guide]
August 17, 2023 - Step-by-step guide to gCC and Development Tools on RHEL 8 / CentOS 8. Includes commands, verification, and troubleshooting.
Find elsewhere
🌐
GitHub
gist.github.com › nchaigne › 9eba78dafb011b138fa513ea5fd016a8
Building GCC 7.3.0 on Red Hat Enterprise Linux 7 · GitHub
This note describes how to build the latest GCC (7.3 as of January 2018) from sources on RHEL 7. This should be applicable as is on CentOS 7. For other Linux distributions, adapt as needed. While this is not overly complicated, building GCC takes quite some time. So you might want to plan to do something else while it builds... a coffee break just won't make it. Prerequisites are described here: https://gcc.gnu.org/install/prerequisites.html
🌐
LinuxConfig
linuxconfig.org › home › how to install gcc the c compiler on rhel 8 / centos 8
How to install GCC the C compiler on RHEL 8 / CentOS 8
September 24, 2019 - The GCC compiler can be installed in RHEL 8 by simply using the dnf install command.
🌐
Reddit
reddit.com › r/redhat › installing gcc5.2.0 in rhel 8.8
r/redhat on Reddit: Installing GCC5.2.0 in RHEL 8.8
December 21, 2023 -

Hi All,

I'm trying to install the GCC5.2.0 in RHEL 8.8 as it requires by the tool that I'm using. I'm installing it manually using its source code that I got from here:
Index of /gnu/gcc/gcc-5.2.0

These are the commands I'm using:

tar -xvf gcc-5.2.0.tar.gz
cd gcc-5.2.0
./contrib/download_prerequisites
./configure --enable-checking=release --enable-packages=c,c++ --disable-multilib
make -j 4

However, I'm getting an error under make -j 4:

I've already installed "Developer Tools" and "gcc-c++" which suggested online but i'm still getting the error.

Any idea how to fix this?

Regards,

🌐
TecMint
tecmint.com › home › open source › how to install gcc and development tools on rhel-based systems
How to Install GCC and Development Tools on RHEL Systems
August 13, 2024 - In this article, we will explain how to install GNU C and C++ compilers and their related development tools in RHEL-based distributions.
🌐
Red Hat
developers.redhat.com › HW › gcc-RHEL-7
Hello World - installing GCC on RHEL 7 | Red Hat Developer
April 13, 2026 - # subscription-manager repos --enable rhel-server-devtools-7-rpms # subscription-manager repos --enable rhel-7-server-optional-rpms · In this next step you will use a single command to download and install GCC 8.2, and other development tools that are part of Red Hat Developer Toolset.
🌐
SciVision
scivision.dev › install-modern-compilers-redhat
Use modern compilers in RHEL | Scientific Computing
July 2, 2023 - GCC Toolset enables modern compiler selection for RHEL users. G++ / Gfortran example: dnf install gcc-toolset-13-gcc-gfortran gcc-toolset-13-gcc-c++
🌐
IT'S FOSS
itsfoss.gitlab.io › post › how-to-install-gcc-and-development-tools-on-rhel-based-systems
How to Install GCC and Development Tools on RHEL-based Systems :: IT'S FOSS
August 15, 2025 - Install GCC development tools on RHEL-based systems. Learn how to set up GNU C/C++ compilers and essential dev tools for your projects.
🌐
Reddit
reddit.com › r/linuxquestions › how do i install gcc from source on rhel 7 (without a subscription!)?
r/linuxquestions on Reddit: How do I install gcc from source on RHEL 7 (WITHOUT A SUBSCRIPTION!)?
September 5, 2018 -

I'm really trying to install a few things but in order to accomplish them I need to first have a C compiler. I am trying to install gcc-8.2.0. This is a sandbox server that is not registered. So no access to the subscription-manager to get all the tools id need to do this easily.

Here is the error message I get when running ./configure:

`` [root@localhost gcc-8.2.0]# ./configure

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

checking target system type... x86_64-pc-linux-gnu

checking for a BSD-compatible install... /bin/install -c

checking whether ln works... yes

checking whether ln -s works... yes

checking for a sed that does not truncate output... /bin/sed

checking for gawk... gawk

checking for libatomic support... yes

checking for libitm support... yes

checking for libsanitizer support... yes

checking for libvtv support... yes

checking for libmpx support... yes

checking for libhsail-rt support... yes

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/home/bdonahue/gcc-8.2.0':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details.

``

I have also been looking into somehow installing CentOS yum repositories in this RHEL 7? Haven't come up with much on that either. Thanks for any help in advance!

🌐
Snapcraft
snapcraft.io › install › gcc-13 › rhel
Install gcc-13 on Red Hat Enterprise Linux using the Snap Store | Snapcraft
May 26, 2025 - sudo subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" sudo yum update Copy to clipboard ... Once installed, the systemd unit that manages the main snap communication socket needs to be enabled:
🌐
Linux Forum
forum.linuxconfig.org › linuxconfig.org articles
How to install GCC the C compiler on RHEL 8 - LinuxConfig.org - LinuxConfig.org Articles - Linux Forum
December 5, 2018 - The objective of this guide is to install GCC the C compiler on RHEL 8 and perform compilation of a basic C "Hello World" program. The GCC compiler can be installed in RHEL 8 by simply using the dnf install command. T…