While installing packages from source, almost every tutorial will instruct you to install build-essentials on Ubuntu.
Sure, there are several reasons why it is so important to install the build-essentials package before installing any package from the source.
So in this tutorial, I will walk you through the following:
- What is build essentials in Ubuntu
- How you can install build-essentials in Ubuntu
- How to remove build essentials from Ubuntu (if required)
Let's start with the first one.
What is the build-essential package in Ubuntu?
As the name suggests, the build-essential package is a meta package, which means it is a set of packages that are essential to building software.
But what are the packages we get in the build-essentials package, you may ask?
Well, here's the list of packages and what are they meant for in the build-essentials package:
gcc: the GNU C compiler (can also be used to compile C++ using additional libraries).
g++: the GNU C++ compiler.
libc6-dev: provides the development libraries and header files for the GNU C Library (glibc).
make: used to make software using the instructions from the makefile.
dpkg-dev: used to create, distribute, and maintain
In a nutshell, these tools are the most crucial when you want to build packages from the source, and this is the reason why they named the meta package "build-essential".
How to install build-essential in Ubuntu
To install the build-essential package, all you have to do is execute the following command:
sudo apt install build-essential
To verify the installation, you can check the installed version of GCC (included in the build-essential package) using the following:
How to uninstall build-essential from Ubuntu
To remove packages from Ubuntu, you use the apt-remove, and the same goes for removing build-essential.
You can use the following command to remove build-essential from Ubuntu:
sudo apt purge --auto-remove build-essential
More on GCC
Once you install GCC, you may want to compile and run C programs. For that, you can refer to our detailed tutorial on how to compile and run C programs:
Here's how to use the g++ to compile the C++ program:
I hope you will find this guide helpful.