Skip to content
Related Articles

Related Articles

How to Install GCC Compiler on Linux?

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 06 Oct, 2021

In this article, we will discuss how to install a GCC compiler on Linux

GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++. The GCC is an open-source collection of compilers and libraries.

Let’s start with the steps to install the GCC on Linux.

To install the GCC open the terminal on Linux.

The terminal takes the input from the user in the form of commands and displays the output on the screen. Hence we have to pass some commands to install the GCC.

Follow the commands step by step to install the GCC.

Command 1: The very first step is to update the packages. This command is used to download package information from all configured sources and to get the info of the updated versions of the packages.

sudo apt-get update
get updates first

command-1

Note: In the first command it will ask for your password, make sure to enter the password correctly.

Command 2: Now we have to install the build-essential packages, which is also known as a meta-package, it contains the GCC compiler all the other essentials used to compile the software written in C and C++ language.

sudo apt install build-essential
build the dependencies

command-2

It will take some time to install all the essential packages.

Command 3: After the second command it will install GCC on your Linux, to verify it is installed correctly, check the version of the GCC.

gcc --version
check gcc version

command-3

Now, we have successfully installed the GCC on Linux.

Note: Versions may vary from time to time.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!