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 Overflowlinux - how to install gcc 4.9.2 on RHEL 7.4 - Stack Overflow
Installing GCC 4.8.2 on Red Hat Enterprise linux 6.5 - Stack Overflow
c - Installing gcc manually redhat - Stack Overflow
software installation - install latest gcc on rhel 6 x86_64 - Unix & Linux Stack Exchange
Videos
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
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}.
- 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.)
- 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}.
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}.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}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}
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}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}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}
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/.
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.
The easiest method by far is to make use of a binary build that's provided through a YUM repository. One such option would be to use the hop5.in repository. Specifically this page: gcc - Various compilers (C, C++, Objective-C, Java, ...). They're providing 4.8.2 which should work with CentOS 6.3 or 6.4. You might want to do an update prior:
$ sudo yum update
The other option would be to make use of the Developer Toolset, specifically the bundled version provided by Scientific Linux.
- http://linux.web.cern.ch/linux/devtoolset/
Following the installation instructions you'll basically do the following 2 steps:
add repositories$ sudo wget -O /etc/yum.repos.d/slc6-devtoolset.repo \
http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
$ wget -O /etc/yum.repos.d/slc5-devtoolset.repo \
http://linuxsoft.cern.ch/cern/devtoolset/slc5-devtoolset.repo
install devtoolset
$ sudo yum install devtoolset-2
Update #1
The hop5.in YUM repository appears to have been removed, so the only recourse is to make use of the devtoolset method highlighted above.
Additional examples for installing via devtoolset are highlighted in this GitHub Gist: Installing gcc 4.8 and Linuxbrew on CentOS 6.
Red Hat Software Collections comes with GCC 4.9 you may look at enabling that channel.