Categories: Ubuntu

What is build-essential Ubuntu, how to install and use it?

The build-essentials packages are meta-packages that are necessary for compiling software. They include the GNU debugger, g++/GNU compiler collection, and some more tools and libraries that are required to compile a program. For example, if you need to work on a C/C++ compiler, you need to install essential meta-packages on your system before starting the C compiler installation. When installing the build-essential packages, some other packages such as G++, dpkg-dev, GCC and make, etc. also install on your system.

Above, we have described what the build-essential packages are. In the rest of the article, we will explain how to install and use build-essentials on Ubuntu systems. All terminal commands we have executed on Ubuntu 20.04 system in this article. Let’s dive into the depths!

Installation
Sponsored
and use of Build Essential tools on Ubuntu 20.04 system

The build-essential meta-packages can be installed directly from the Ubuntu official repository. These packages are available in the default Ubuntu 20.04 system repository. Just install meta-packages of build-essential tools through the apt package manager. Open the terminal application through the keyboard shortcut ‘Ctrl + Alt + t’.

Update apt repository

Now, you need to update the packages repository before installing the build-essential tools. Type the following command to update the apt repository index:

$ sudo apt update

Install build-essential

Install the build-essential packages by running the below-given command:

$ sudo apt install build-essential

After executing the above command, the following result will be shown on the terminal:

Check GCC version

Once the installation is finished, verify the installation of these packages by checking the GCC version on your system with the following command:

$ gcc –version

The installed version of GCC to be displayed on the terminal, which is also shown in the following screenshot:

Now, all GCC compiler libraries and tools have been installed on Ubuntu 20.04 system. However, you can run a C program for testing the installation.

Create C program

Let’s create a C program by using the nano editor as follows:

Sponsored
$ nano testprogram.c

Now, add the below-mentioned lines of code in this nano file:

// testprogram.c

int main() {
    printf(“Test, Program!n);
    return 0;
}

Compiling the C program

Save the above file and make an executable file by using the following command:

$ gcc testprogram.c -o testprogram

Run C program

Now, execute the following command to run the C program:

$ ./testprogram

The following output is shown on the terminal after running the above C program:

Conclusion

We have explained the installation of build-essential tools in this article. We have explored what is build-essential and how to install and use it on Ubuntu 20.04 system. Now, you should have the proper understanding of the build-essential and how to install it on the Ubuntu system. The above commands can also be applied to the older Ubuntu versions. To learn more about these required packages, must visit their official website for a better understanding.

Ubuntu Server Admin

Recent Posts

Canonical and NVIDIA BlueField-4: a foundation for zero-trust high performance infrastructure

At NVIDIA GTC Washington D.C., Canonical is pleased to support the arrival of the NVIDIA…

23 hours ago

Global-ready from day one

How Anbox Cloud streamlines localization testing Wherever users are based, they expect apps to just…

3 days ago

Canonical announces new optimized Ubuntu image for Thundercomm RUBIK Pi 3

Ubuntu now runs natively on the Thundercomm RUBIK Pi 3 developer board – a lightweight…

6 days ago

Introducing Canonical Academy

Validate your skills and advance your career with recognized qualifications from the publishers of Ubuntu…

6 days ago

🚀 Deploy Poweradmin to Manage PowerDNS on Ubuntu VPS

This article demonstrates how to deploy Poweradmin to manage PowerDNS on Ubuntu VPS server. What…

6 days ago

Self-Hosting Easypanel and n8n on Ubuntu VPS

This article provides an outline for self-hosting Easypanel and n8n on Ubuntu VPS. What is…

6 days ago