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 › epel-x86_64 › gcc-c++-x86_64-linux-gnu-4.8.5-16.el7.1.x86_64.rpm.html
gcc-c++-x86_64-linux-gnu-4.8.5-16.el7.1.x86_64.rpm CentOS 7 Download
Install gcc-c++-x86_64-linux-gnu rpm package: # yum install gcc-c++-x86_64-linux-gnu · 2017-06-27 - Lubomir Rintel <lkundrak@v3.sk> - 4.8.5-16.1 - Align with RHEL7 gcc · 2014-06-07 - Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.8.2-2.1 - Rebuilt for https://fedoraproj...
🌐
CentOS Repositories
centos.pkgs.org › 7 › centos-x86_64 › gcc-4.8.5-39.el7.x86_64.rpm.html
gcc-4.8.5-39.el7.x86_64.rpm CentOS 7 Download
Install gcc rpm package: # yum install gcc · 2019-02-26 - Marek Polacek <polacek@redhat.com> 4.8.5-39 - fix pr63567-2.c and pr63567-4.c ·
🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-newbie-8 › installing-gcc-rpm-on-red-hat-780713
Installing gcc rpm on Red Hat
I'm using Red Hat. I don't know how to tell which version, but here's this: Code: -bash-3.2 uname -a Linux lunchhub.com 2.6.9-023stab048.6-enterprise
Find elsewhere
🌐
GitHub
gist.github.com › stephenturner › e3bc5cfacc2dc67eca8b
Installing gcc 4.8 and Linuxbrew on CentOS 6 · GitHub
$ sudo yum install centos-release-scl $ sudo yum install devtoolset-3-toolchain $ scl enable devtoolset-3 bash · $ gcc --version gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6) ... bash-4.1$ cmake ..
🌐
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 - in emergency mode I can't run this: cat /var/log/yum.log | grep gcc it said ... so you likely have a mess now which can never be fixed. most likely! and what i did is install that rpm from CentOS application store ! amazing ! I don't like that CentoS linux thing, I downlaod all .rpm from repo of centos and all working fine except this!
🌐
GitHub
gist.github.com › nchaigne › ad06bc867f911a3c0d32939f1e930a11
Building GCC 9.2.0 on CentOS 7 · GitHub
You will need ~1 GB for gcc sources, ~6 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 it, ...
🌐
Bobsteagall
bobsteagall.com › 2017 › 12 › 30 › gcc-builder
Building GCC on Linux – The State Machine
December 30, 2017 - It’s quick and easy to do the installation, it’s trivial to remove an installation, and absolutely no system configuration files, directories, or databases are affected. Create an RPM. It’s also possible to create an RPM: ... The resulting RPM will be created in the ./packages subdirectory.
🌐
Pkgs.org
pkgs.org › download › gcc-c++
Gcc-c++ Download for Linux (rpm)
Download gcc-c++ packages for AlmaLinux, ALT Linux, Amazon Linux, CentOS, Fedora, Mageia, OpenMandriva, openSUSE, PCLinuxOS, Rocky Linux
🌐
Linuxize
linuxize.com › home › gcc › how to install gcc compiler on centos 7
How to Install GCC Compiler on CentOS 7 | Linuxize
October 31, 2019 - We’ll explain how to install the distro stable version and the newer version of GCC available from the SCL repository. To add new repositories and install packages on your CentOS system, you must be logged in as root or user with sudo privileges .
🌐
RPMfind
rpmfind.net › linux › rpm2html › search.php
RPM resource gcc
The search service can find package by either name (apache), provides(webserver), absolute file names (/usr/bin/apache), binaries (gprof) or shared libraries (libXm.so.2) in standard path. It does not support multiple arguments yet · The System and Arch are optional added filters, for example ...
🌐
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?