No Internet access, the use of CD-ROM installation of GCC and gcc-c++ method is as follows:
First put the CD into the optical drive, the virtual machine in the words on the ISO CD image can be.
And then the following:
[Root@localhost ~]# more gcc_install.sh
#!/bin/bash
Mount/dev/cdrom/mnt
cd/mnt/centos/
RPM-IVH glibc-common-2.5-42.i386.rpm
RPM-IVH kernel-headers-2.6.18-164.el5.i386.rpm
RPM-IVH libgcc-4.1.2-46.el5.i386.rpm
RPM-IVH glibc-2.5-42.i686.rpm
RPM-IVH cpp-4.1.2-46.el5.i386.rpm
RPM-IVH libgomp-4.4.0-6.el5.i386.rpm
RPM-IVH nscd-2.5-42.i386.rpm
RPM-IVH glibc-headers-2.5-42.i386.rpm
RPM-IVH glibc-devel-2.5-42.i386.rpm
RPM-IVH gcc-4.1.2-46.el5.i386.rpm
echo "GCC is installed successful!!!"
RPM-IVH libstdc++-4.1.2-46.el5.i386.rpm
RPM-IVH libstdc++-devel-4.1.2-46.el5.i386.rpm
RPM-IVH gcc-c++-4.1.2-46.el5.i386.rpm
echo "gcc-c++ is installed successful!!!"
[root@localhost ~]# chmod +x gcc_install.sh
[Root@localhost ~]#./gcc_install.sh
Mount:block Device/dev/cdrom is write-protected, mounting read-only
Warning:glibc-common-2.5-42.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
Package glibc-common-2.5-42.i386 is already installed
Warning:kernel-headers-2.6.18-164.el5.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
1:kernel-headers ########################################### [100%]
Warning:libgcc-4.1.2-46.el5.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
Package libgcc-4.1.2-46.el5.i386 is already installed
Warning:glibc-2.5-42.i686.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
Package glibc-2.5-42.i686 is already installed
Warning:cpp-4.1.2-46.el5.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
Package cpp-4.1.2-46.el5.i386 is already installed
Warning:libgomp-4.4.0-6.el5.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
1:libgomp ########################################### [100%]
Warning:nscd-2.5-42.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
Package nscd-2.5-42.i386 is already installed
Warning:glibc-headers-2.5-42.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
1:glibc-headers ########################################### [100%]
Warning:glibc-devel-2.5-42.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
1:glibc-devel ########################################### [100%]
Warning:gcc-4.1.2-46.el5.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
1:GCC ########################################### [100%]
GCC is installed successful!!!
Warning:libstdc++-4.1.2-46.el5.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ... ########################################### [100%]
Package libstdc++-4.1.2-46.el5.i386 is already installed
Warning:libstdc++-devel-4.1.2-46.el5.i386.rpm:header V3 DSA Signature:nokey, key ID e8562897
Preparing ...