日期:2014-05-16  浏览次数:20689 次

RedHat Enterprise Linux 5 安装GCC过程

Red Hat Enterprise 5默认是不安装gcc的,需要自己手动安装。gcc所需要的包都可以在安装光盘上找到,至于最新的gcc可以在 http://gcc.gnu.org/ 下载,但是是以源码的形式压缩的,需要对其进行编译。

Solution
1、插入安装盘,首先在/mnt下创建cdrom文件夹,然后挂载安装盘:mount /dev/cdrom /mnt/cdrom;

  ???? 说明,要保证cdrom文件夹存在,否则会报错。

?2、进入/mnt/cdrom/Server,按顺序安装以下包,具体版本可以根据tab键来确定,仅供参考:

(1)安装kernel-headers-2.6.18-194.el5.x86_64.rpm

?? [root@localhost Server]# rpm -ivh ./kernel-headers-2.6.18-194.el5.x86_64.rpm
?? warning: ./kernel-headers-2.6.18-194.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key???? ID????37017186
?? Preparing...??????????????? ########################################### [100%]
? 1:kernel-headers???????? ########################################### [100%]

(2)安装glibc-headers-2.5-49.x86_64.rpm

[root@localhost Server]# rpm -ivh ./glibc-headers-2.5-49.x86_64.rpm
warning: ./glibc-headers-2.5-49.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...??????????????? ########################################### [100%]
1:glibc-headers????????? ########################################### [100%]

(3)安装glibc-devel-2.5-49.x86_64.rpm

[root@localhost Server]# rpm -ivh ./glibc-devel-2.5-49.
glibc-devel-2.5-49.i386.rpm??? glibc-devel-2.5-49.x86_64.rpm
[root@localhost Server]# rpm -ivh ./glibc-devel-2.5-49.x86_64.rpm
warning: ./glibc-devel-2.5-49.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...??????????????? ########################################### [100%]
?1:glibc-devel??????????? ########################################### [100%]

(4)安装libgomp-4.4.0-6.el5.x86_64.rpm

[root@localhost Server]# rpm -ivh ./libgomp-4.4.0-6.el5.
libgomp-4.4.0-6.el5.i386.rpm??? libgomp-4.4.0-6.el5.x86_64.rpm
[root@localhost Server]# rpm -ivh ./libgomp-4.4.0-6.el5.x86_64.rpm
warning: ./libgomp-4.4.0-6.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...??????????????? ########################################### [100%]
1:libgomp??????????????? ########################################### [100%]

(5)安装gcc-4.1.2-48.el5.x86_64.rpm

[root@localhost Server]# rpm -ivh gcc-4.1.2-48.el5.x86_64.rpm
warning: gcc-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...??????????????? ########################################### [100%]
1:gcc??????????????????? ########################################### [100%]

(6)安装libstdc++-devel-4.1.2-48.el5.x86_64.rpm

[root@localhost Server]# rpm -ivh ./libstdc++-devel-4.1.2-48.el5.x86_64.rpm
warning: ./libstdc++-devel-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...??????????????? ########################################### [100%]
?1:libstdc++-devel??????? ########################################### [100%]

(7)安装gcc-c++-4.1.2-48.el5.x86_64.rpm

warning: ./gcc-c++-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...??????????????? ########################################### [100%]
?1:gcc-c++??????????????? ########################################### [100%]

最后进入/mnt,输入rpm –qa gcc* ,如果成功安装了gcc,可以查出以下内容:

[root@localhost mnt]# rpm -qa gcc*
gcc-c++-4.1.2-48.el5
gcc-4.1.2-48.el5
[root@localhost mnt]#