≡ Menu

CentOS / RHEL 7: Install GCC (C and C++ Compiler) and Development Tools

How do I install gnu gcc compiler and related tools such as autoconf, automake, flex, c++ compiler, and bison on a CentOS 7 or Red Hat Enterprise Linux version 7 server?

You can setup a basic development environment with the following packages on a CentOS Enterprise Linux or Red Hat Enterprise Linux version 7:

  1. autoconf
  2. automake
  3. binutils
  4. bison
  5. flex
  6. gcc
  7. gcc-c++
  8. gettext
  9. libtool
  10. make
  11. patch
  12. pkgconfig
  13. redhat-rpm-config
  14. rpm-build
  15. rpm-sign

Open the Terminal app and type the following commands.

Command to list groups on a CentOS / RHEL 7

Type the following yum command:
# yum group list
Sample outputs:

Fig. 01: CentOS / RHEL 7: List Package Groups Command

Fig. 01: CentOS / RHEL 7: List Package Groups Command

Command to install GCC and Development Tools on a CentOS / RHEL 7 server

Type the following [nixcmd name=”yum” as root user:
# yum group install "Development Tools"
$ sudo yum group install "Development Tools"
If above command failed, try:
# yum groupinstall "Development Tools"
Sample outputs:
Animated gif.01: Installing C & C++ and related packages on a CentOS and RHEL 7

Animated gif 01: Installing C & C++ and related packages on a CentOS and RHEL 7

Verify your gcc installation on a CentOS / RHEL 7 server

Type the following command to see gcc location:

$ whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz

Type the following command to see gcc compiler version:

$ gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

Test gcc C compiler with a sample foo.c program

Create a file called foo.c as follows:

int main(void){
	printf("Hello World!\n");
	return 0;

To compile foo.c into foo executable file, type:
$ cc foo.c -o foo
To execute foo program, type:

$ ./foo
Hello World!
Share this tutorial on:
{ 15 comments… add one }
  • danilo July 14, 2014, 8:53 pm

    Just use yum install gcc*

    It will install all gcc software and upgrade all the files to satisfy dependices

  • kirti October 21, 2014, 7:09 am

    We should have no space between group and install.
    #yum groupinstall “Development Tools”

    Please update.

  • greendruid October 29, 2014, 10:17 am

    Please, fix ‘group install’ -> ‘groupinstall’.
    For example:
    yum groupinstall “Development Tools”

  • xfree November 27, 2014, 3:44 am

    yum group install “Development Tools”
    right is
    yum groupinstall “Development Tools”

  • tom July 12, 2015, 12:26 am

    hello, i have a Problem with gcc, when i need
    when I run include command I get the following message:
    bash: syntax error near unexpected token `newline ‘

  • lata July 12, 2015, 5:28 pm

    #yum install “development tools” is not working in centos 7

    • Mickey December 2, 2015, 5:54 pm

      Use groupinstall as the article says…

      • Donavan May 3, 2016, 10:42 pm

        for centos/rhel 7 use (missing the “s” off groups):
        yum groups install “Development Tools”

        Durring install if you get any errors regarding kernel packages ex:

        –> Finished Dependency Resolution
        Error: Package: systemtap-devel-2.8-10.el7.x86_64 (base)
        Requires: kernel-devel

        All kernel packages are on the yum exclude list so you may need to do the following:
        yum -y install kernel-devel –disableexcludes=all

        to see all groups available:
        yum groups list

  • Richard Klein July 20, 2015, 5:30 pm

    In Centos 7:
    Warning: Group development does not have any packages to install.

    • Mickey December 2, 2015, 5:55 pm

      Put quotes around the “Development Tools” group name, as per the article (copy and paste is your friend)!

  • aref ghobadi August 15, 2015, 9:39 am

    I really appreciate your help

  • AlucarD March 4, 2016, 3:34 pm

    on CentOS 7 you can try this( It is one line !!) :
    yum groupinstall "Development Tools" --setopt=group_package_types=mandatory,default,optional

    this is a yum setup.
    Have a nice day,

    • vietsoft April 29, 2016, 12:27 am

      @AlucarD’s way is definitely works

  • boboc alexandru September 1, 2016, 2:34 pm

    so, how do i became root? it says i have to be root to perform this action

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , ,