1. 安装 gcc

  1. > mkdir /sourcecode/soft/gcc-rpm
  2. > cd /sourcecode/soft/gcc-rpm

从Centos系统安装镜像中取出需要的rpm包,如图3.4:
将这些rpm包放至指定目录并安装:

Gcc 4.8.5安装(离线) - 图1
图 3.4

# 全量安装,自动寻找依赖
> rpm -Uvh *.rpm --nodeps --force
Preparing...                          ################################# [100%]
Updating / installing...
   1:libgcc-4.8.5-28.el7              ################################# [  5%]
   2:glibc-2.17-222.el7               ################################# [ 11%]
   3:mpfr-3.1.1-4.el7                 ################################# [ 16%]
   4:zlib-1.2.7-17.el7                ################################# [ 21%]
   5:libmpc-1.0.1-3.el7               ################################# [ 26%]
   6:cpp-4.8.5-28.el7                 ################################# [ 32%]
   7:binutils-2.27-27.base.el7        ################################# [ 37%]
   8:libgomp-4.8.5-28.el7             ################################# [ 42%]
   9:libstdc++-devel-4.8.5-28.el7     ################################# [ 47%]
  10:kernel-headers-3.10.0-862.el7    ################################# [ 53%]
  11:glibc-headers-2.17-222.el7       ################################# [ 58%]
  12:glibc-devel-2.17-222.el7         ################################# [ 63%]
  13:gcc-4.8.5-28.el7                 ################################# [ 68%]
  14:gcc-c++-4.8.5-28.el7             ################################# [ 74%]
Cleaning up / removing...
  15:binutils-2.27-34.base.el7        ################################# [ 79%]
  16:zlib-1.2.7-18.el7                ################################# [ 84%]
  17:libgomp-4.8.5-36.el7             ################################# [ 89%]
  18:glibc-2.17-260.el7               ################################# [ 95%]
  19:libgcc-4.8.5-36.el7              ################################# [100%]
# 检查安装结果
> gcc -v
gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)