I'd recommend using yum localinstall rather than using the rpm command directly; that way you'll have the gcc package in your yum database so that it can keep track of updates. The command would just be:

yum localinstall /mnt/cdrom/CentOS/gcc-(whatever).rpm
Answer from gareth_bowles on serverfault.com
🌐
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.
🌐
CentOS Repositories
centos.pkgs.org › 7 › centos-sclo-rh-testing-x86_64 › devtoolset-7-gcc-7.2.1-1.el7.x86_64.rpm.html
devtoolset-7-gcc-7.2.1-1.el7.x86_64.rpm CentOS 7 Download
yum install centos-release-scl-rh · Install devtoolset-7-gcc rpm package: # yum --enablerepo=centos-sclo-rh-testing install devtoolset-7-gcc · 2017-08-31 - Marek Polacek <polacek@redhat.com> 7.2.1-1 - update from Fedora gcc-7.2.1-1 · 2017-08-28 - Marek Polacek <polacek@redhat.com> 7.1.1-7.1 ...
🌐
LinuxHostSupport
linuxhostsupport.com › home › how to install gcc on centos 7
How To Install GCC on CentOS 7 | LinuxHostSupport
May 24, 2019 - On centos 7 I have installed ccg 7.3.0: #gcc –version gcc (GCC) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. however, gfortran version is 4 # gfortran –version GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16) I really need gfortran 6 o newer for some application · please help me, I had tried many things and they didn’t work. ... You can install GNU Fortran using yum, RPM package or build it from source.
Find elsewhere
🌐
Centos
lists.centos.org › hyperkitty › list › discuss@lists.centos.org › thread › POTHJYRWJSSESJ3TWDHO76JIMAXZBYCS
Package of GCC 12 on CentOS 7 - Discuss - lists.centos.org
Is there an rpm of GCC 12 (or at least higher than 9) available to download and install, or is it a case of downloading and build from the source yourself?
🌐
GitHub
gist.github.com › nchaigne › 9eba78dafb011b138fa513ea5fd016a8
Building GCC 7.3.0 on Red Hat Enterprise Linux 7 · GitHub
cd /home/build wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libmpc-devel-1.0.1-3.el7.x86_64.rpm yum install libmpc-devel-1.0.1-3.el7.x86_64.rpm · Or you can build the latest version from sources: cd /home/build MPC_VERSION=1.1.0 wget https://ftp.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz cd mpc-${MPC_VERSION} configure make make install · cd /home/build GCC_VERSION=7.3.0 wget https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.gz tar xzvf gcc-${GCC_VERSION}.tar.gz mkdir obj.gcc-${GCC_VERSION} cd obj.gcc-${GCC_VERSION} ../gcc-${GCC_VERSION}/configure --disable-multilib make make install ·
🌐
GitHub
gist.github.com › nchaigne › ad06bc867f911a3c0d32939f1e930a11
Building GCC 9.2.0 on CentOS 7 · GitHub
A couple more steps are needed to install the gcc 9 libraries as well: yum install centos-release-scl -y yum clean all yum install devtoolset-9-* -y scl enable devtoolset-9 bash
🌐
Experts Exchange
experts-exchange.com › questions › 29178462 › install-the-gcc-c-4-8-5-39-el7-x86-64-rpm-to-my-test-Centos-linux-box-make-it-to-emergency-mode-can't-start-GUI-anymore.html
Solved: install the gcc-c++4.8.5-39.el7.x86_64.rpm to my test Centos linux box make it to emergency mode, can't start GUI anymore. | Experts Exchange
April 11, 2020 - $ sudo rpm -qa | grep -i gcc $ sudo rpm -qa | grep -i gcc [sudo] password for murugesandins: devtoolset-2-gcc-4.8.2-15.1.el5 libgcc-4.1.2-55.el5 devtoolset-1.1-gcc-c++-4.7.2-5.el5 gcc-c++-4.1.2-55.el5 gcc44-c++-4.4.7-11.el5_11 devtoolset-1....
🌐
CentOS Repositories
centos.pkgs.org › 7 › centos-sclo-rh-x86_64 › devtoolset-7-gcc-c++-7.2.1-1.el7.x86_64.rpm.html
devtoolset-7-gcc-c++-7.2.1-1.el7.x86_64.rpm CentOS 7 Download
yum install centos-release-scl-rh · Install devtoolset-7-gcc-c++ rpm package: # yum install devtoolset-7-gcc-c++ 2017-08-31 - Marek Polacek <polacek@redhat.com> 7.2.1-1 - update from Fedora gcc-7.2.1-1 · 2017-08-28 - Marek Polacek <polacek@redhat.com> 7.1.1-7.1 - don't Provide "gcc" (#1485002) ...
🌐
CentOS Repositories
centos.pkgs.org › 7 › centos-sclo-rh-x86_64 › devtoolset-9-gcc-c++-9.3.1-2.el7.x86_64.rpm.html
devtoolset-9-gcc-c++-9.3.1-2.el7.x86_64.rpm CentOS 7 Download
yum install centos-release-scl-rh · Install devtoolset-9-gcc-c++ rpm package: # yum install devtoolset-9-gcc-c++ 2020-04-08 - Marek Polacek <polacek@redhat.com> 9.3.1-2 - update from Fedora gcc-9.3.1-2 · 2020-04-07 - Marek Polacek <polacek@redhat.com> 9.3.1-1.1 - include the c++/93597 fix ...
🌐
CentOS Repositories
centos.pkgs.org › 7 › centos-sclo-rh-testing-x86_64 › devtoolset-9-gcc-9.3.1-2.el7.x86_64.rpm.html
devtoolset-9-gcc-9.3.1-2.el7.x86_64.rpm CentOS 7 Download
yum install centos-release-scl-rh · Install devtoolset-9-gcc rpm package: # yum --enablerepo=centos-sclo-rh-testing install devtoolset-9-gcc · 2020-04-08 - Marek Polacek <polacek@redhat.com> 9.3.1-2 - update from Fedora gcc-9.3.1-2 · 2020-04-07 - Marek Polacek <polacek@redhat.com> 9.3.1-1.1 ...
🌐
RPMfind
rpmfind.net › linux › rpm2html › search.php
RPM resource gcc
The System and Arch are optional added filters, for example System could be "redhat", "redhat-7.2", "mandrake" or "gnome", Arch could be "i386" or "src", etc. depending on your system. The GNU Compiler Collection (GCC) provides a standard conforming and highly portable ISO C and ISO C++ compiler.