Linux环境下通过rpm安装gcc的顺序

时间:2022-01-12 02:28:42

首先查看Linux版本:

[root@host1-vm2 ~]# lsb_release -a
LSB Version::core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID:RedHatEnterpriseServer
Description:Red Hat Enterprise Linux Server release 5.4 Beta (Tikanga)
Release:5.4
Codename:Tikanga

上传版本所需要的rpm包

-rw-r--r-- 1 root root 5521285 2009-05-22 gcc-4.1.2-46.el5.x86_64.rpm
-rw-r--r-- 1 root root 3934300 2009-05-22 gcc-c++-4.1.2-46.el5.x86_64.rpm
-rw-r--r-- 1 root root 2524696 2009-05-22 glibc-devel-2.5-38.x86_64.rpm
-rw-r--r-- 1 root root 604558 2009-05-22 glibc-headers-2.5-38.x86_64.rpm
-rw-r--r-- 1 root root 1043099 2009-06-23 kernel-headers-2.6.18-155.el5.x86_64.rpm
-rw-r--r-- 1 root root 69699 2009-06-09 libgomp-4.4.0-6.el5.x86_64.rpm
-rw-r--r-- 1 root root 2942157 2009-05-22 libstdc++-devel-4.1.2-46.el5.x86_64.rpm


开始安装

[root@host1-vm2 gcc_rpm]# 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 897da07a
Preparing... ########################################### [100%]
1:libgomp ########################################### [100%]
[root@host1-vm2 gcc_rpm]# rpm -ivh kernel-headers-2.6.18-155.el5.x86_64.rpm
warning: kernel-headers-2.6.18-155.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 897da07a
Preparing... ########################################### [100%]
1:kernel-headers ########################################### [100%]
[root@host1-vm2 gcc_rpm]# rpm -ivh glibc-headers-2.5-38.x86_64.rpm
warning: glibc-headers-2.5-38.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 897da07a
Preparing... ########################################### [100%]
1:glibc-headers ########################################### [100%]
[root@host1-vm2 gcc_rpm]# rpm -ivh glibc-devel-2.5-38.x86_64.rpm
warning: glibc-devel-2.5-38.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 897da07a
Preparing... ########################################### [100%]
1:glibc-devel ########################################### [100%]
[root@host1-vm2 gcc_rpm]# rpm -ivh gcc-
gcc-4.1.2-46.el5.x86_64.rpm gcc-c++-4.1.2-46.el5.x86_64.rpm
[root@host1-vm2 gcc_rpm]# rpm -ivh gcc-4.1.2-46.el5.x86_64.rpm
warning: gcc-4.1.2-46.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 897da07a
Preparing... ########################################### [100%]
1:gcc ########################################### [100%]

验证gcc

[root@host1-vm2 gcc_rpm]# gcc -v
使用内建 specs。
目标:x86_64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
线程模型:posix
gcc 版本 4.1.2 20080704 (Red Hat 4.1.2-46)

安装gcc-c++

[root@host1-vm2 gcc_rpm]# rpm -ivh libstdc++-devel-4.1.2-46.el5.x86_64.rpm 
warning: libstdc++-devel-4.1.2-46.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 897da07a
Preparing... ########################################### [100%]
1:libstdc++-devel ########################################### [100%]
[root@host1-vm2 gcc_rpm]# rpm -ivh gcc-c++-4.1.2-46.el5.x86_64.rpm
warning: gcc-c++-4.1.2-46.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 897da07a
Preparing... ########################################### [100%]
1:gcc-c++ ########################################### [100%]

搞定!