centos中安装 gcc编译器


1、查看系统

[root@centos7pc1 test3]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@centos7pc1 test3]# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.9.2009 (Core)
Release:        7.9.2009
Codename:       Core

2、测试gcc

[root@centos7pc1 test3]# gcc --version
bash: gcc: command not found...

3、安装gcc

[root@centos7pc1 test3]# yum install gcc gcc-c++ kernel-devel -y

4、测试

[root@centos7pc1 test3]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)      ## 没有问题
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.