How to Install GCC Compiler on Ubuntu

GCC is a common compiler of multiple programming languages including C, C++, Java etc. Many open source projects are compiled using GCC.

In this article, we will cover step by step to install GCC in Ubuntu. This will aply for 20.04, 18.04 and 16.04 LTS distribution system.

Prerequisites: To install GCC in your system, you must be logged in as sudo user.

Step 1: Update the package repository

Update package repository list to latest with bellow command.

sudo apt-get update

Step 2: Install essential build packages

Now install the build-essential package as it is required, it will also install gcc, g++, make etc.

sudo apt-get install build-essential

Step 3: Install manual pages

Install manpages-dev package which provides all manual details for the softwares.

sudo apt-get install manpages-dev

Step 4: Check GCC version

If you want to check that GCC is successfully installed in your system, run bellow command. It will print current gcc version

gcc --version

Congratulations, GCC is now installed in your system and you can now start compiling. For more information on GCC, visit the official documentation page.