(转载)RedHat Enterprise Linux 5 安装GCC

注:在RedHat Enterprise Linux 5使用gcc编译第一个程序时,发现其gcc并未安装。在网上搜索看到这篇帖子。遂转到此处进行学习。感谢博客园中的“风尘孤客”的分享。@风尘孤客

 

 

Abstraction 

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

Solution

  1、插入安装盘,首先在/mnt下创建cdrom文件夹,然后挂载安装盘:mount /dev/cdrom /mnt/cdrom;
  2、进入/mnt/cdrom/Server,按顺序安装以下包:
(1)安装kernel-headers-2.6.18-128.el5.i386.rpm
[root@localhost Server]# rpm -ivh ./kernel-headers-2.6.18-128.el5.i386.rpm
warning: ./kernel-headers-2.6.18-128.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:kernel-headers ########################################### [100%]
(2)安装glibc-headers-2.5-34.i386.rpm
[root@localhost Server]# rpm -ivh ./glibc-headers-2.5-34.i386.rpm
warning: ./glibc-headers-2.5-34.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:glibc-headers ########################################### [100%]
(3)安装glibc-devel-2.5-34.i386.rpm
[root@localhost Server]# rpm -ivh ./glibc-devel-2.5-34.i386.rpm
warning: ./glibc-devel-2.5-34.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:glibc-devel ########################################### [100%]
(4)安装libgomp-4.3.2-7.el5.i386.rpm
[root@localhost Server]# rpm -ivh ./libgomp-4.3.2-7.el5.i386.rpm
warning: ./libgomp-4.3.2-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:libgomp ########################################### [100%]
(5)安装rpm -ivh gcc-4.1.2-44.el5.i386.rpm
[root@localhost Server]# rpm -ivh gcc-4.1.2-44.el5.i386.rpm
warning: gcc-4.1.2-44.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:gcc ########################################### [100%]
(6)安装libstdc++-devel-4.1.2-44.el5.i386.rpm
[root@localhost Server]# rpm -ivh ./libstdc++-devel-4.1.2-44.el5.i386.rpm
warning: ./libstdc++-devel-4.1.2-44.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:libstdc++-devel ########################################### [100%]
(7)安装gcc-c++-4.1.2-44.el5.i386.rpm
[root@localhost Server]# rpm -ivh ./gcc-c++-4.1.2-44.el5.i386.rpm
warning: ./gcc-c++-4.1.2-44.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:gcc-c++ ########################################### [100%]
 此过程中有可能需要安装其他的安装包, 如下:
[root@localhost Server]# rpm -ivh gcc-4.1.2-14.el5.i386.rpm
warning: gcc-4.1.2-14.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        glibc-devel >= 2.2.90-12 is needed by gcc-4.1.2-14.el5.i386
找到相应的安装包安装即可
[root@localhost Server]# rpm -ivh gcc-4.1.2-14.el5.i386.rpm
warning: gcc-4.1.2-14.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        glibc-devel >= 2.2.90-12 is needed by gcc-4.1.2-14.el5.i386
[root@localhost Server]# rpm -ivh glibc-devel-2.5-18.i386.rpm
warning: glibc-devel-2.5-18.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:glibc-devel            ########################################### [100%]
3、最后进入/mnt,输入rpm –qa gcc* ,如果成功安装了gcc,可以查出以下内容:
binutils-2.13.90.0.18-9.i386.rpm
cpp-3.2.2-5.i386.rpm

 

转载于:https://www.cnblogs.com/doitjust/p/6375953.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值