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

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
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
c - Installing gcc manually redhat - Stack Overflow
I am working on a system on which I am a non-root user. While trying to install gcc 5.1 in a custom directory as the present shared version of gcc isn't working for postgresql installation, I star... More on stackoverflow.com
🌐 stackoverflow.com
software installation - install latest gcc on rhel 6 x86_64 - Unix & Linux Stack Exchange
Worth mentioning that devtoolset-2-gcc ... for yum install devtoolset-2. ... Red Hat Software Collections comes with GCC 4.9 you may look at enabling that channel. ... I've built newer gcc versions for rhel6 for several versions now (since 4.7.x to 5.3.1). The process is fairly easy thanks to Redhat's Jakub Jelinek ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
April 20, 2014
🌐
Red Hat
developers.redhat.com › HW › gcc-RHEL-7
Hello World - installing GCC on RHEL 7 | Red Hat Developer
April 13, 2026 - 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. The length of time this step takes depends on the speed of your Internet connection and your system.
🌐
Red Hat
developers.redhat.com › blog › 2019 › 03 › 05 › yum-install-gcc-8-clang-6
How to install GCC 8 and Clang/LLVM 6 on Red Hat Enterprise Linux 7 | Red Hat Developer
November 1, 2023 - How to install the latest stable versions of GCC and Clang/LLVM on Red Hat Enterprise Linux. Also covers tips for working with software collections and permanently enabling GCC 8/Clang 6
🌐
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 - To install all the packages belonging to a package group called “Development Tools” use the following command: # yum --setopt=group_package_types=mandatory,default,optional groupinstall "Development Tools" OR # yum --setopt=group_package_types=mandatory,default,optional group install "Development Tools" The yum has changed in Red Hat Enterprise Linux 7/CentOS 7. The package group “Development Tools”” has only the optional packages which by default doesn’t get installed. So we will need to pass the option --setopt=group_package_types=mandatory,default,optional to install the optional packages too. Type the following which command or type command/command command to see the gcc binary location.
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_developer_toolset › 9 › html › user_guide › chap-gcc
Chapter 2. GNU Compiler Collection (GCC) | User Guide | Red Hat Developer Toolset | 9 | Red Hat Documentation
In Red Hat Developer Toolset, the GNU C compiler is provided by the devtoolset-9-gcc package and is automatically installed with devtoolset-9-toolchain as described in Section 1.5, “Installing Red Hat Developer Toolset”.
Find elsewhere
🌐
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.
🌐
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.
🌐
GitHub
gist.github.com › nchaigne › 9eba78dafb011b138fa513ea5fd016a8
Building GCC 7.3.0 on Red Hat Enterprise Linux 7 · GitHub
You will need ~700 MB for gcc sources, ~5.2 GB for the build). Be prepared. This will install gcc in /usr/local/bin/gcc (default prefix is /usr/local). Your distro gcc (/usr/bin/gcc) will not be overwritten, but if later on you need to invoke ...
🌐
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,

🌐
Stack Overflow
stackoverflow.com › questions › 30806947 › installing-gcc-manually-redhat
c - Installing gcc manually redhat - Stack Overflow
rm -rf newgcc mkdir newgcc cd newgcc tar xzf gcc-5.1.tar.gz cd gcc-5.1 ./contrib/download_prerequisites mkdir ../bld cd ../bld ../gcc-5.1/configure <configopts> make -j8 make install
🌐
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 - Check installed GCC version. ... gcc --version gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ make --version GNU Make 4.2.1 Built for x86_64-redhat...
🌐
Red Hat
developers.redhat.com › articles › 2025 › 04 › 16 › gcc-and-gcc-toolset-versions-rhel-explainer
GCC and gcc-toolset versions in RHEL: An explainer | Red Hat Developer
April 16, 2025 - For newer features: Use gcc-toolset if you need access to the latest GCC features, but be aware of the shorter 2-year support window. Note that you can install gcc and multiple versions of gcc-toolset (e.g., gcc-toolset-12 and gcc-toolset-14) concurrently on the same system, as they install ...
🌐
Red Hat
developers.redhat.com › articles › build-your-first-app-native-gcc-rhel-6-or-7
Build your first app with native GCC on RHEL 6 or 7 | Red Hat Developer
January 2, 2024 - Create your first Hello World with the native GCC C++ on Red Hat Enterprise Linux in under 10 minutes. ... In this tutorial, you will install the RHEL native GNU Compiler Collection (GCC) and build a simple C++ Hello World application. This tutorial should take less than 10 minutes to complete.
🌐
LinuxQuestions.org
linuxquestions.org › questions › red-hat-31 › install-gcc-4-8-4-on-redhat-linux-4-a-4175554373
Install gcc 4.8.4 on RedHat Linux 4
Hi All, I need to install gcc version 4.8.4 on my "Red Hat Enterprise Linux ES release 4 (Nahant Update 8)". I have uninstalled existing gcc
🌐
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 just the C compiler sudo dnf install -y gcc # Install the C++ compiler sudo dnf install -y gcc-c++ # Install make separately sudo dnf install -y make # Verify the installations gcc --version g++ --version make --version · # Show the ...