Install GCC and Development Tools on RHEL 8 / CentOS 8

Posted on 105 views

How do I install Development Tools on RHEL 8 / CentOS 8?. RHEL based distributions are designed for enterprise and running mission-critical applications. It is the most stable and secure Server Operating System. For security reasons and performance, they often ship with fewer packages pre-installed.

If you want to do Development or build open source applications on RHEL / CentOS 8, you need to install Development tools which include the following tools.

  • autoconf
  • automake
  • gcc
  • gcc-c++
  • bison
  • flex
  • binutils
  • gdb
  • glibc-devel
  • libtool
  • make
  • pkgconf
  • pkgconf-m4
  • pkgconf–pkg-config
  • redhat-rpm-config
  • rpm-build
  • rpm-sign
  • strace

List package groups on a CentOS / RHEL 8

Type the following dnf command to list package groups available on your CentOS / RHEL 8.

$ dnf group list 
....
Last metadata expiration check: 0:00:01 ago on Tue 07 Jun 2022 03:36:40 PM UTC.
Available Environment Groups:
   Server with GUI
   Server
   Minimal Install
   Workstation
   Virtualization Host
   Custom Operating System
Available Groups:
   Container Management
   .NET Core Development
   RPM Development Tools
   Development Tools
   Graphical Administration Tools
   Headless Management
   Legacy UNIX Compatibility
   Network Servers
   Scientific Support
   Security Tools
   Smart Card Support
   System Tools

You can pass the summary option to view the number of installed groups, available groups, available environment groups, and both installed and available language groups:

$ sudo dnf groups summary
Updating Subscription Management repositories.
Updating Subscription Management repositories.
Last metadata expiration check: 0:06:33 ago on Sun 17 Mar 2019 09:28:36 AM EAT.
Installed Groups: 2
Available Groups: 10

Install GCC and Development Tools on a CentOS / RHEL 8 server

The following command is used to install GCC and Development Tools on a CentOS / RHEL 8 server.

sudo dnf group install "Development Tools"

Or with the command below:

sudo dnf groupinstall "Development Tools"

You can view information on the Development Tools package group.

sudo dnf group info "Development Tools"

Verify installation by checking tools binary locations.

$ whereis bison gcc flex
bison: /usr/bin/bison /usr/share/bison /usr/share/man/man1/bison.1.gz /usr/share/info/bison.info.gz
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz /usr/share/info/gcc.info.gz
flex: /usr/bin/flex /usr/share/man/man1/flex.1.gz /usr/share/info/flex.info-1.gz /usr/share/info/flex.info-2.gz /usr/share/info/flex.info.gz

Check installed GCC version.

$ gcc --version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10)
Copyright (C) 2018 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.

$ make --version
GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Uninstalling GCC and Development Tools on a CentOS / RHEL 8 server

Below is the command used to remove a Package Group on CentOS / RHEL 8.

sudo dnf group remove "Development Tools"

Be keen on dependency tree to avoid breaking other system packages.

Test GCC Compiler

Let’s create a Hello World program to see if it compiles properly.

$ vim  hello.c
#include 

int main() 
    printf("Hello, world!\n");
    return 0;

Compile the code with GCC.

gcc hello.c -o helloworld

Run the program to see if it prints Hello, world!.

$ ./helloworld 
Hello, world!

Thank you for installing GCC and Development Tools on RHEL / CentOS 8 using our guide.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.