gcc离线安装

通常,最小化安装 centos 7.9 无gcc环境,如果yum有效的话可以通过 yum install -y gcc-c++ glibc-static gcc 来安装gcc环境,但在特定场景只能离线安装的话,就需要安装太多的依赖,下面介绍一下gcc离线安装的方法。

  • 第1步,确认gcc没有安装
[root@localhost ~]# gcc --version
-bash: gcc: command not found
  • 第2步,下载gcc依赖的所有rpm包
[root@localhost ~]# cd /opt
[root@localhost ~]# wget -c http://iso.sqlfans.cn/linux/gcc-4.8.5.zip
[root@localhost ~]# unzip gcc-4.8.5.zip

[root@localhost ~]# ll gcc-4.8.5
total 133376
-rw-r--r--. 1 root root  6236420 Mar 16  2019 cpp-4.8.5-36.el7.x86_64.rpm
-rw-r--r--. 1 root root 16964548 Mar 16  2019 gcc-4.8.5-36.el7.x86_64.rpm
-rw-r--r--. 1 root root  7534972 Mar 16  2019 gcc-c++-4.8.5-36.el7.x86_64.rpm
-rw-r--r--. 1 root root  3807660 Mar 16  2019 glibc-2.17-222.el7.x86_64.rpm
-rw-r--r--. 1 root root 12052860 Mar 16  2019 glibc-common-2.17-222.el7.x86_64.rpm
-rw-r--r--. 1 root root  1116252 Mar 16  2019 glibc-devel-2.17-222.el7.x86_64.rpm
-rw-r--r--. 1 root root   694524 Mar 16  2019 glibc-headers-2.17-222.el7.x86_64.rpm
-rw-r--r--. 1 root root 48328640 Mar 16  2019 kernel-3.10.0-862.11.6.el7.x86_64.rpm
-rw-r--r--. 1 root root 16498492 Mar 16  2019 kernel-devel-3.10.0-862.11.6.el7.x86_64.rpm
-rw-r--r--. 1 root root  7483960 Mar 16  2019 kernel-headers-3.10.0-862.11.6.el7.x86_64.rpm
-rw-r--r--. 1 root root  6577448 Mar 16  2019 kernel-tools-3.10.0-862.11.6.el7.x86_64.rpm
-rw-r--r--. 1 root root  6483404 Mar 16  2019 kernel-tools-libs-3.10.0-862.11.6.el7.x86_64.rpm
-rw-r--r--. 1 root root   349148 Mar 16  2019 kexec-tools-2.0.15-13.el7.x86_64.rpm
-rw-r--r--. 1 root root   103952 Mar 16  2019 libgcc-4.8.5-36.el7.x86_64.rpm
-rw-r--r--. 1 root root   161048 Mar 16  2019 libgomp-4.8.5-36.el7.x86_64.rpm
-rw-r--r--. 1 root root    51732 Mar 16  2019 libmpc-1.0.1-3.el7.x86_64.rpm
-rw-r--r--. 1 root root   311728 Mar 16  2019 libstdc++-4.8.5-36.el7.x86_64.rpm
-rw-r--r--. 1 root root  1580028 Mar 16  2019 libstdc++-devel-4.8.5-36.el7.x86_64.rpm
-rw-r--r--. 1 root root   208316 Mar 16  2019 mpfr-3.1.1-4.el7.x86_64.rpm
  • 第3步,通过rpm的方式安装gcc
[root@localhost ~]# cd /opt/gcc-4.8.5
[root@localhost ~]# rpm -Uvh *.rpm --nodeps --force
  • 第4步,确认gcc版本
[root@localhost ~]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Copyright © www.sqlfans.cn 2023 All Right Reserved更新时间: 2023-11-30 12:23:52

results matching ""

    No results matching ""