【gcc 离线安装】10分钟教你centos7.4 离线安装gcc

1、首先查看系统发行版本

cat /etc/redhat-release

(base) [root@ai software]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
(base) [root@ai software]#

我们的系统是CentOS Linux release 7.4.1708 (Core),
在没有外网的情况下,如何安装gcc

  1. 下载RPM包(任选一个源)

国外:

https://vault.centos.org/7.8.2003/os/x86_64/Packages/

国内:

清华源:https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.8.2003/os/x86_64/Packages/

中科大源:https://mirrors.ustc.edu.cn/centos-vault/7.8.2003/os/x86_64/Packages/

163源:http://mirrors.163.com/centos-vault/7.8.2003/os/x86_64/Packages/

我选择的是清华源下载,打开网址:

https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.8.2003/os/x86_64/Packages/

3、依次下载如下安装包全部放在一个文件夹里:


cpp-4.8.5-39.el7.x86_64.rpm
gcc-4.8.5-39.el7.x86_64.rpm
glibc-2.17-307.el7.1.x86_64.rpm
glibc-common-2.17-307.el7.1.x86_64.rpm
glibc-devel-2.17-307.el7.1.x86_64.rpm
glibc-headers-2.17-307.el7.1.x86_64.rpm
kernel-headers-3.10.0-1127.el7.x86_64.rpm
libgcc-4.8.5-39.el7.x86_64.rpm
libgomp-4.8.5-39.el7.x86_64.rpm
libmpc-1.0.1-3.el7.x86_64.rpm
mpfr-3.1.1-4.el7.x86_64.rpm

4、安装
执行如下命令安装:

rpm -Uvh *.rpm --nodeps --force

5、验证,gcc --version


(base) [root@ai software]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
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.

(base) [root@ai software]#


6、验证,make --version

(base) [root@ai software]# make --version
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
(base) [root@ai software]#

大功告成。

猜你喜欢

转载自blog.csdn.net/u013421629/article/details/130607257
今日推荐