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
🌐
Red Hat
developers.redhat.com › articles › 2023 › 11 › 10 › install-gcc-and-build-hello-world-application-rhel-8
Install GCC and build a Hello World application on RHEL 8 | Red Hat Developer
November 10, 2023 - In this step, you will use a single ... and install GCC 12.x and other development tools that are part of the Red Hat Developer Toolset. The length of time this step takes depends on the speed of your Internet connection and system. With a reasonably fast connection, this step should take only a minute. Red Hat Enterprise Linux provides a ...
🌐
Red Hat
developers.redhat.com › articles › 2023 › 11 › 10 › install-gcc-and-build-hello-world-application-rhel-9
Install GCC and build a Hello World application on RHEL 9 | Red Hat Developer
November 10, 2023 - # cat /etc/redhat-release Red Hat Enterprise Linux release 9.2 (Plow) List the GCC-related repositories using the following command: ... In this step, you will use a single command to download and install GCC 12.x and other development tools that are part of the Red Hat Developer Toolset.
Discussions

linux - how to install gcc 4.9.2 on RHEL 7.4 - Stack Overflow
I am trying to install gcc and g++ 4.9.2 on Linux. I'm pretty new with Linux and i saw some guides of how to install, but each time I encountered with another problem. I don't have any gcc right no... More on stackoverflow.com
🌐 stackoverflow.com
Installing GCC 4.8.2 on Red Hat Enterprise linux 6.5 - Stack Overflow
Consider just installing the Redhat Developer Toolset, which is an add-on that packages more recent versions of some important development software, including GCC. The commercial RedHat version is here: access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset The free identical CentOS version (works on RHEL) is here: linux... More on stackoverflow.com
🌐 stackoverflow.com
c - Installing gcc manually redhat - Stack Overflow
While trying to install gcc 5.1 ... installation, I started out by wget gcc 5.1. After unzipping the folder, ran the commands below: cd /seq/genome_portal/lib mkdir bld mkdir gcc cd bld /seq/genome_portal/lib/gcc-5.1/configure --prefix=/seq/genome_portal/lib/gcc ... /../../redhat_6_x86_64/pkgs/gcc_4.9.0/libexec/gcc/x86_64-redhat-linux/4.9.0/cc1: ... 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 › 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
🌐
Red Hat
developers.redhat.com › HW › gcc-RHEL-7
Hello World - installing GCC on RHEL 7 | Red Hat Developer
February 13, 2019 - If you are using a desktop edition of Red Hat Enterprise Linux, change -server- to -desktop- in the following commands: # 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.
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}

🌐
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.
🌐
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.
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
🌐
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 › 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 - For RHEL 6 use g++ -v to see what version you have installed. $ pass:[g++] -v gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ... Red Hat Developer Toolset provides the latest, stable, open source C and C++ compilers and complementary development tools including Eclipse. DTS enables developers to compile applications once and deploy across multiple versions of Red Hat Enterprise Linux.
Top answer
1 of 2
10

The official way to have gcc 4.8.2 on RHEL 6 is via installing Red Hat Developer Toolset (yum install devtoolset-2), and in order to have it you need to have one of the below subscriptions:

  • Red Hat Enterprise Linux Developer Support, Professional
  • Red Hat Enterprise Linux Developer Support, Enterprise
  • Red Hat Enterprise Linux Developer Suite
  • Red Hat Enterprise Linux Developer Workstation, Professional
  • Red Hat Enterprise Linux Developer Workstation, Enterprise
  • 30 day Self-Supported Red Hat Enterprise Linux Developer Workstation Evaluation
  • 60 day Supported Red Hat Enterprise Linux Developer Workstation Evaluation
  • 90 day Supported Red Hat Enterprise Linux Developer Workstation Evaluation
  • 1-year Unsupported Partner Evaluation Red Hat Enterprise Linux
  • 1-year Unsupported Red Hat Advanced Partner Subscription

You can check whether you have any of these subscriptions by running:

subscription-manager list --available

and

subscription-manager list --consumed.

If you don't have any of these subscriptions, you won't succeed in "yum install devtoolset-2". However, luckily cern provide a "back door" for their SLC6 which can also be used in RHEL 6. Run below three lines via root, and you should be able to have it:

wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo

wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-cern http://ftp.scientificlinux.org/linux/scientific/5x/x86_64/RPM-GPG-KEYs/RPM-GPG-KEY-cern

yum install devtoolset-2

Once it's done completely, you should have the new development package in /opt/rh/devtoolset-2/root/.

2 of 2
1

For some reason the mpc/mpfr/gmp packages aren't being downloaded. Just look in your gcc source directory, it should have created symlinks to those packages:

gcc/4.9.1/install$ ls -ad gmp mpc mpfr
gmp  mpc  mpfr

If those don't show up then simply download them from the gcc site: ftp://gcc.gnu.org/pub/gcc/infrastructure/

Then untar and symlink/rename them so you have the directories like above. Then when you ./configure and make, gcc's makefile will automatically build them for you.

🌐
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
Red Hat Developer Toolset is distributed with GCC 9.3.1. This version is more recent than the version included in Red Hat Enterprise Linux and provides a number of bug fixes and enhancements. 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”.
🌐
Stack Overflow
stackoverflow.com › questions › 30806947 › installing-gcc-manually-redhat
c - Installing gcc manually redhat - Stack Overflow
While trying to install gcc 5.1 ... ran the commands below: cd /seq/genome_portal/lib mkdir bld mkdir gcc cd bld /seq/genome_portal/lib/gcc-5.1/configure --prefix=/seq/genome_portal/lib/gcc ......
🌐
LinuxQuestions.org
linuxquestions.org › questions › red-hat-31 › how-to-install-gcc-in-red-hat-enterprise-889304
how to install GCC in Red Hat Enterprise?
June 30, 2011 - Hi, does anyone know how to install the GCC compiler onto a Red Hat Enterprise system? Where to download it, and instructions to install it. Thank you.
🌐
Snapcraft
snapcraft.io › install › gcc-13 › rhel
Install gcc-13 on Red Hat Enterprise Linux using the Snap Store | Snapcraft
May 26, 2025 - Get the latest version of gcc-13 for on Red Hat Enterprise Linux - the GNU Compiler Collection version 13.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › centos › download and install c, c++ compiler on red hat enterprise linux 5 (rhel)
Download and Install C, C++ Compiler on Red Hat Enterprise Linux 5 (RHEL) - nixCraft
April 5, 2024 - ... [root@brijendra ~]# yum install gcc gcc-c++ autoconf automake Gathering header information file(s) from server(s) Server: Red Hat Linux 16 - x86_64 - Base retrygrab() failed for: http://mirror.dulug.duke.edu/pub/yum-repository/redhat/16...