How to Install GCC Compiler on Ubuntu 20.04

Install GCC Compiler on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure GCC Compiler on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

GCC or GNU Compiler Collection is released by the Free Software Foundation and as the name suggests, it is a very useful collection of programming compilers such as C, C++, Objective-C, Objective-C++, Fortran, Java, Go and Ada. Many open source projects including the GNU tools and the Linux kernel are compiled with GCC.

Install GCC Compiler on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install GCC Compiler on Ubuntu.

So installing the GCC compiler on Ubuntu is as simple as installing build-essential package:

sudo apt install build-essential

Once the installation is complete, you can verify the version by typing:

# gcc --version

gcc (Ubuntu 9.4.0-10ubuntu2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

Step 3. Test Compiling.

To test a compiling, Let’s create a small program. Open your nano text editor and create the following file:

nano welcome.c
int main() {
    printf("You're welcome!\n");
    return 0;

Save it as welcome.c and compile it using following command:


Results show:

You're welcome!

That’s all you need to do to install GCC on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. Don’t forget to share your valuable queries/suggestions in the below comment box & also drop your worthwhile feedback.