AlmaLinuxLinuxTutorials

How To Install GCC Compiler on AlmaLinux 8

Install GCC Compiler on AlmaLinux 8

In this tutorial, we will show you how to install GCC Compiler on AlmaLinux 8. For those of you who didn’t know, GCC, short for GNU Compiler Collection, is a powerful and versatile compiler system that supports various programming languages, including C, C++, Objective-C, Fortran, Ada, Go, and D. It is an essential tool for software developers working on Linux systems, as it enables them to compile and build applications from source code. AlmaLinux 8, a community-driven, free, and open-source operating system, is fully compatible with GCC, making it an ideal platform for development.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the GCC Compiler on an AlmaLinux 8. You can follow the same instructions for CentOS and Rocky Linux.

Prerequisites

  • A server running one of the following operating systems: AlmaLinux 8, CentOS, and Rocky Linux 8.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A stable internet connection to download the required packages.
  •  A non-root sudo user or root access to the AlmaLinux 8 system.

Install GCC Compiler on AlmaLinux 8

Step 1. Before proceeding with the GCC installation, it’s crucial to ensure that your AlmaLinux 8 system is up-to-date with the latest available packages. This step not only ensures compatibility but also addresses potential security vulnerabilities and bug fixes. To update your system, open the terminal and execute the following command:

sudo dnf update
sudo dnf clean all

Step 2. Installing GCC Compiler on AlmaLinux 8.

By default, GCC is available on the AlmaLinux 8 base repository. Now we run the following command to install the latest GCC Compiler to your system:

sudo dnf group install "Development Tools"

This command will install the “Development Tools” group package, which includes GCC along with various other essential tools and libraries for software development. The installation process may take a few minutes, depending on your internet connection speed and system resources.

After 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"

After the installation is complete, you can verify the installed version of GCC by running the following command:

gcc --version

This command will display the version of GCC installed on your system. If the installation was successful, you should see output similar to the following:

gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
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.

Step 3. Testing The GCC Compiler.

For example, now we create a file called “hello.c” in your home directory with your favorite editor:

sudo nano hello.c

Add the following file:

#include <stdio.h>

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

Next, compile the “hello.c” source code:

gcc hello.c -o helloworld

Then, execute the program using the HelloWorld executable file which was created above:

./helloworld

Congratulations! You have successfully installed GCC. Thanks for using this tutorial for installing the GCC Compiler on your AlmaLinux 8 system. For additional help or useful information, we recommend you check the official GCC website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button