Share your love
Easy Steps To Install GCC Compiler on AlmaLinux 9

In this guide on the Orcacore website, we want to teach you to Install GCC Compiler on AlmaLinux 9. GCC is a set of compilers for various languages (Ada, C, C++, Fortran, ObjC, ObjC++, and at one point java). It provides all of the infrastructure for building software in those languages from source code to assembly.
It is responsible for the conversion of the “high-level” source code in the respective language and ensuring that it is semantically valid, performing well-formed optimizations, and converting it to assembly code.
Also, it provides the general “driver” to invoke the various tools in the toolchain, so that you do not need to worry about the exact ordering of a large number of implementation details about the object file format and underlying runtime library.
Table of Contents
Steps To Install GCC Compiler on AlmaLinux 9
To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with AlmaLinux 9.
1. Installing GCC Compiler on AlmaLinux 9
First, you need to update your local package index with the following command:
# sudo dnf update -y
# sudo dnf clean all
The GCC compiler packages are available in the package group called “Development tools“. Development tools are the tools that are required to build applications or libraries for GNU/Linux.
Development Tools on AlmaLinux 9
You can check that you have the development tools are installed on your system, by using the command below:
sudo dnf group list

If the Development Tools is not listed, you will need to install it by running the following command:
sudo dnf group install "Development Tools"
Check Development Tools Info
Once the compiler and its package are installed, use the following command to show all information about the Development Tools:
sudo dnf group info "Development Tools"

Then, verify your GCC installation on AlmaLinux 9 by checking its version:
gcc --version
Output
gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-2)
Copyright (C) 2021 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.
To see the installation path of GCC, you can use the command below:
whereis gcc
Output
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz /usr/share/info/gcc.info.gz
2. Test GCC Compiler on AlmaLinux 9
At this point, you can test your GCC compiler by creating a sample project. First, create a file called “hello.c” in your home directory with your favorite text editor, here we use the vi editor:
cd ~ && sudo vi hello.c
Add the following content to the file:
#include <stdio.h>
int main() {
printf("OrcaCore, Hello world!\n");
return 0;
}
When you are done, save and close the file.
Next, compile the “hello.c” source code with the GCC compiler on AlmaLinux 9 by using the following command:
gcc hello.c -o helloworld
Then, run the executable HelloWorld file:
./helloworld
In your output you should see:
Output
OrcaCore, Hello world!
Conclusion
At this point, you have learned to Install the GCC Compiler on AlmaLinux 9 and create a test program with it. Please subscribe to us on Facebook, Twitter, and YouTube.
Hope you enjoy it. You may also like these articles:
Install and Configure WireGuard on AlmaLinux 9
Install Nagios Monitoring Tool on AlmaLinux 9
What You Need to Know about AlmaLinux 10
Telegram Desktop Installation on AlmaLinux 9