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.comI'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
You want to use something like rpm -ivh /mnt/cdrom/CentOS/gcc-(whatever).rpm. The command line options there are:
-i-- install (you can use-Uto install or upgrade, many just always use that)-v-- verbose output-h-- show hashmarks, a simplistic progress bar
Yum will figure out which package you mean if you type yum install gcc. That'll use your chosen repository, or the CD if you've got the correct repository installed (which you probably do). In general, yum is easier to use if you're not doing anything strange.
Tru Huynh of centos.org has built the redhat developer toolset 1.1, for centos and it contains gcc 4.7.2
So you could simply use his repo and install just gcc, instantly.
cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo
yum --enablerepo=testing-1.1-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++
This will install it most likely into /opt/centos/devtoolset-1.1/root/usr/bin/
Then you can tell your compile process to use the gcc 4.7 instead of 4.4 with the CC variable
export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++
Here is how to get devtoolset-2 (including gcc 4.8.1)
This was taken from http://people.centos.org/tru/devtools-2/readme
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
Known issues:
- unsigned packages
- CentOS-6 devtoolset-2 needs devtoolset-2-ide which contains the whole Eclipse stack, but does not build yet
- CentOS-6 all the maven related file are not built either
Main changes from devtools-1.1:
/opt/centosis no longer used/opt/rhis now used as upstream (as SL version)