第一种方法:
相信现在还有不少人在用经典的RedHat9,毕竟他是完全免费的红帽Linux嘛!
现在介绍一下在安装gcc时可能遇到的问题。
在安装gcc时,可能会提示要求安装下面几个软件包:
binutils-2.13.90.0.18-9.i386.rpm
cpp-3.2.2-5.i386.rpm
glibc-devel-2.3.2-11.9.i386.rpm
在安装gcc时,可能会提示要求安装下面几个软件包:
binutils-2.13.90.0.18-9.i386.rpm
cpp-3.2.2-5.i386.rpm
glibc-devel-2.3.2-11.9.i386.rpm
别担心,一步一步来。首先在red hat 第一张光盘中查找以上三个软件包,并安装它们。
[root@RedHat9 mnt]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@RedHat9 mnt]# find -iname binutils*
./cdrom/RedHat/RPMS/binutils-2.13.90.0.18-9.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/binutils-2.13.90.0.18-9.i386.rpm
warning: cdrom/RedHat/RPMS/binutils-2.13.90.0.18-9.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:binutils ########################################### [100%]
[root@RedHat9 mnt]# find -iname cpp*
./cdrom/RedHat/RPMS/cpp-3.2.2-5.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/cpp-3.2.2-5.i386.rpm
warning: cdrom/RedHat/RPMS/cpp-3.2.2-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:cpp ########################################### [100%]
[root@RedHat9 mnt]# find -iname glibc-devel*
./cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm
warning: cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
error: Failed dependencies:
kernel-headers is needed by glibc-devel-2.3.2-11.9
kernel-headers >;= 2.2.1 is needed by glibc-devel-2.3.2-11.9
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@RedHat9 mnt]# find -iname binutils*
./cdrom/RedHat/RPMS/binutils-2.13.90.0.18-9.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/binutils-2.13.90.0.18-9.i386.rpm
warning: cdrom/RedHat/RPMS/binutils-2.13.90.0.18-9.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:binutils ########################################### [100%]
[root@RedHat9 mnt]# find -iname cpp*
./cdrom/RedHat/RPMS/cpp-3.2.2-5.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/cpp-3.2.2-5.i386.rpm
warning: cdrom/RedHat/RPMS/cpp-3.2.2-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:cpp ########################################### [100%]
[root@RedHat9 mnt]# find -iname glibc-devel*
./cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm
warning: cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
error: Failed dependencies:
kernel-headers is needed by glibc-devel-2.3.2-11.9
kernel-headers >;= 2.2.1 is needed by glibc-devel-2.3.2-11.9
这时不要查找kernel-headers,放心,你在三张光盘中都找不到kernel-headers的。你要查找glibc-kernheaders,看下面:
[root@RedHat9 mnt]# find -iname glibc-k*
./cdrom/RedHat/RPMS/glibc-kernheaders-2.4-8.10.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/glibc-kernheaders-2.4-8.10.i386.rpm
warning: cdrom/RedHat/RPMS/glibc-kernheaders-2.4-8.10.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:glibc-kernheaders ########################################### [100%]
[root@RedHat9 mnt]# find -iname glibc-devel*
./cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm
warning: cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:glibc-devel ########################################### [100%]
./cdrom/RedHat/RPMS/glibc-kernheaders-2.4-8.10.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/glibc-kernheaders-2.4-8.10.i386.rpm
warning: cdrom/RedHat/RPMS/glibc-kernheaders-2.4-8.10.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:glibc-kernheaders ########################################### [100%]
[root@RedHat9 mnt]# find -iname glibc-devel*
./cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm
warning: cdrom/RedHat/RPMS/glibc-devel-2.3.2-11.9.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:glibc-devel ########################################### [100%]
到此为止,gcc所依赖的软件包都安装了,现在插入第二张光盘,安装gcc:
[root@RedHat9 mnt]# umount /mnt/cdrom
[root@RedHat9 mnt]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@RedHat9 mnt]# find -iname gcc*
./cdrom/RedHat/RPMS/gcc-3.2.2-5.i386.rpm
./cdrom/RedHat/RPMS/gcc-c++-3.2.2-5.i386.rpm
./cdrom/RedHat/RPMS/gcc-g77-3.2.2-5.i386.rpm
./cdrom/RedHat/RPMS/gcc-gnat-3.2.2-5.i386.rpm
./cdrom/RedHat/RPMS/gcc-java-3.2.2-5.i386.rpm
./cdrom/RedHat/RPMS/gcc-objc-3.2.2-5.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/gcc-3.2.2-5.i386.rpm
warning: cdrom/RedHat/RPMS/gcc-3.2.2-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:gcc ########################################### [100%]
[root@RedHat9 mnt]#
[root@RedHat9 mnt]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@RedHat9 mnt]# find -iname gcc*
./cdrom/RedHat/RPMS/gcc-3.2.2-5.i386.rpm
./cdrom/RedHat/RPMS/gcc-c++-3.2.2-5.i386.rpm
./cdrom/RedHat/RPMS/gcc-g77-3.2.2-5.i386.rpm
./cdrom/RedHat/RPMS/gcc-gnat-3.2.2-5.i386.rpm
./cdrom/RedHat/RPMS/gcc-java-3.2.2-5.i386.rpm
./cdrom/RedHat/RPMS/gcc-objc-3.2.2-5.i386.rpm
[root@RedHat9 mnt]# rpm -ivh cdrom/RedHat/RPMS/gcc-3.2.2-5.i386.rpm
warning: cdrom/RedHat/RPMS/gcc-3.2.2-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:gcc ########################################### [100%]
[root@RedHat9 mnt]#
现在查看一下gcc有没有装好:
[root@RedHat9 mnt]# rpm -qa gcc*
gcc-3.2.2-5
[root@RedHat9 mnt]#
gcc-3.2.2-5
[root@RedHat9 mnt]#
gcc终于安装成功啦!:)
第二种方法:(我没测试 呵呵)
wget http://download.fedora.us/fedora/redhat/9/i386/RPMS.stable/apt-0.5.5cnc6-0.fdr.8.rh90.i386.rpm
rpm -i apt*.rpm
apt-get update
apt-get install gcc