Linux(RHEL6.0)下安装GCC

查看系统版本

[root@CP-RHEL proc]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.0 (Santiago)
Kernel \r on an \m

查看系统是否安装GCC

输入gcc,提示gcc命令没找到,说明未安装

[root@CP-RHEL proc]# gcc
-bash: gcc: command not found

准备RPM软件包

准备rpm软件包,如下图所示,可去网上下载,也可以直接从光盘镜像中拷贝过来;

我的操作系统是装在虚拟机里,系统镜像是网上下载的,直接用7z打开iso文件,如下,可以找到以上的rpm软件包。

开始安装

将需要的rpm软件包拷贝到linux操作系统里(可以用文件传输工具,或者使用mount挂载到硬盘来安装也是可以的),依次安装以下软件包:

rpm -ivh kernel-headers-2.6.32-71.el6.x86_64.rpm

rpm -ivh glibc-headers-2.12-1.7.el6.x86_64.rpm

rpm -ivh glibc-devel-2.12-1.7.el6.x86_64.rpm

rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm

rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm

rpm -ivh cpp-4.4.4-13.el6.x86_64.rpm

rpm -ivh binutils-2.20.51.0.2-5.11.el6.x86_64.rpm

rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm

rpm -ivh gcc-4.4.4-13.el6.x86_64.rpm

验证是否安装

输入gcc,提示没有输入文件,说明安装ok

[root@CP-RHEL gcc-install]# gcc
gcc: 没有输入文件

安装日志

checking for OS
 + Linux 2.6.32-71.el6.x86_64 x86_64
checking for C compiler ... not found

./configure: error: C compiler cc is not found

[root@CP-RHEL nginx-1.10.2]# ^C
[root@CP-RHEL nginx-1.10.2]#
[root@CP-RHEL nginx-1.10.2]# ls
auto        conf       html      man     src
CHANGES     configure  LICENSE   objs
CHANGES.ru  contrib    Makefile  README
[root@CP-RHEL nginx-1.10.2]# cd /usr/local/
[root@CP-RHEL local]# ls
apache-tomcat-7.0.72         lib
apache-tomcat-7.0.72.tar.gz  lib64
bin                          libexec
etc                          nginx-1.10.2
games                        nginx-1.10.2.tar.gz
gcc-install                  sbin
include                      share
jdk1.7.0_25                  src
jdk-7u25-linux-x64.tar.gz    测试
[root@CP-RHEL local]# cd gcc-install/
[root@CP-RHEL gcc-install]# ls
binutils-2.20.51.0.2-5.11.el6.x86_64.rpm
cpp-4.4.4-13.el6.x86_64.rpm
gcc-4.4.4-13.el6.x86_64.rpm
glibc-devel-2.12-1.7.el6.x86_64.rpm
glibc-headers-2.12-1.7.el6.x86_64.rpm
[root@CP-RHEL gcc-install]# rpm -ivh glibc-headers-2.12-1.7.el6.x86_64.rpm
warning: glibc-headers-2.12-1.7.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
        kernel-headers is needed by glibc-headers-2.12-1.7.el6.x86_64
        kernel-headers >= 2.2.1 is needed by glibc-headers-2.12-1.7.el6.x86_64
[root@CP-RHEL gcc-install]# ls
binutils-2.20.51.0.2-5.11.el6.x86_64.rpm  glibc-devel-2.12-1.7.el6.x86_64.rpm
cpp-4.4.4-13.el6.x86_64.rpm               glibc-headers-2.12-1.7.el6.x86_64.rpm
gcc-4.4.4-13.el6.x86_64.rpm
[root@CP-RHEL gcc-install]# ls
binutils-2.20.51.0.2-5.11.el6.x86_64.rpm  glibc-devel-2.12-1.7.el6.x86_64.rpm
cpp-4.4.4-13.el6.x86_64.rpm               glibc-headers-2.12-1.7.el6.x86_64.rpm
gcc-4.4.4-13.el6.x86_64.rpm
[root@CP-RHEL gcc-install]# rpm -ivh glibc-headers-2.12-1.7.el6.x86_64.rpm
warning: glibc-headers-2.12-1.7.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
        kernel-headers is needed by glibc-headers-2.12-1.7.el6.x86_64
        kernel-headers >= 2.2.1 is needed by glibc-headers-2.12-1.7.el6.x86_64
[root@CP-RHEL gcc-install]# ls
binutils-2.20.51.0.2-5.11.el6.x86_64.rpm  glibc-devel-2.12-1.7.el6.x86_64.rpm
cpp-4.4.4-13.el6.x86_64.rpm               glibc-headers-2.12-1.7.el6.x86_64.rpm
gcc-4.4.4-13.el6.x86_64.rpm               kernel-headers-2.6.32-71.el6.x86_64.rpm
[root@CP-RHEL gcc-install]# rpm -ivh kernel-headers-2.6.32-71.el6.x86_64.rpm
warning: kernel-headers-2.6.32-71.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:kernel-headers         ########################################### [100%]
[root@CP-RHEL gcc-install]# ls
binutils-2.20.51.0.2-5.11.el6.x86_64.rpm  glibc-devel-2.12-1.7.el6.x86_64.rpm
cpp-4.4.4-13.el6.x86_64.rpm               glibc-headers-2.12-1.7.el6.x86_64.rpm
gcc-4.4.4-13.el6.x86_64.rpm               kernel-headers-2.6.32-71.el6.x86_64.rpm
[root@CP-RHEL gcc-install]# rpm -ivh glibc-devel-2.12-1.7.el6.x86_64.rpm
warning: glibc-devel-2.12-1.7.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
        glibc-headers is needed by glibc-devel-2.12-1.7.el6.x86_64
        glibc-headers = 2.12-1.7.el6 is needed by glibc-devel-2.12-1.7.el6.x86_64
[root@CP-RHEL gcc-install]# rpm -ivh glibc-headers-2.12-1.7.el6.x86_64.rpm
warning: glibc-headers-2.12-1.7.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:glibc-headers          ########################################### [100%]
[root@CP-RHEL gcc-install]# rpm -ivh glibc-devel-2.12-1.7.el6.x86_64.rpm
warning: glibc-devel-2.12-1.7.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:glibc-devel            ########################################### [100%]
[root@CP-RHEL gcc-install]# rpm -ivh cpp-4.4.4-13.el6.x86_64.rpm
warning: cpp-4.4.4-13.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
        libmpfr.so.1()(64bit) is needed by cpp-4.4.4-13.el6.x86_64
[root@CP-RHEL gcc-install]# ^C
[root@CP-RHEL gcc-install]# ^C
[root@CP-RHEL gcc-install]# ^C
[root@CP-RHEL gcc-install]# ^C
[root@CP-RHEL gcc-install]# ls
binutils-2.20.51.0.2-5.11.el6.x86_64.rpm  glibc-headers-2.12-1.7.el6.x86_64.rpm
cpp-4.4.4-13.el6.x86_64.rpm               kernel-headers-2.6.32-71.el6.x86_64.rpm
gcc-4.4.4-13.el6.x86_64.rpm               mpfr-2.4.1-6.el6.x86_64.rpm
glibc-devel-2.12-1.7.el6.x86_64.rpm       ppl-0.10.2-11.el6.x86_64.rpm
[root@CP-RHEL gcc-install]# rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm
warning: mpfr-2.4.1-6.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:mpfr                   ########################################### [100%]
[root@CP-RHEL gcc-install]# rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm
warning: ppl-0.10.2-11.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:ppl                    ########################################### [100%]
[root@CP-RHEL gcc-install]# rpm -ivh cpp-4.4.4-13.el6.x86_64.rpm
warning: cpp-4.4.4-13.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:cpp                    ########################################### [100%]
[root@CP-RHEL gcc-install]# rpm -ivh binutils-2.20.51.0.2-5.11.el6.x86_64.rpm
warning: binutils-2.20.51.0.2-5.11.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
        package binutils-2.20.51.0.2-5.11.el6.x86_64 is already installed
[root@CP-RHEL gcc-install]# rpm -ivh gcc-4.4.4-13.el6.x86_64.rpm
warning: gcc-4.4.4-13.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
        cloog-ppl >= 0.15 is needed by gcc-4.4.4-13.el6.x86_64
[root@CP-RHEL gcc-install]# ^C
[root@CP-RHEL gcc-install]# rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
warning: cloog-ppl-0.15.7-1.2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:cloog-ppl              ########################################### [100%]
[root@CP-RHEL gcc-install]# rpm -ivh gcc-4.4.4-13.el6.x86_64.rpm
warning: gcc-4.4.4-13.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:gcc                    ########################################### [100%]
[root@CP-RHEL gcc-install]# gcc
gcc: 没有输入文件

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值