All the build-essential packages which we will use in this tutorial belong to Debian because Ubuntu is based on Debian. A build-essential package contains all the required packages and dependencies to build an application from Source.
What is the build-essential package?
A build-essential package gives you freedom from relying on your package manager to download required packages. You can download almost anything by building software from its source whether it is available in your package manager or not.
Build-essential is called meta-packages (A package that contains more packages inside of it). It in itself does not install anything but provides a link to other packages that will be installed as Dependencies.
The build-essential meta-package will install everything required to compile a basic Software written in C and C++ Language.
What does the build-essential meta-package contain?
On our Ubuntu System, this build-essential meta-package contains five individual packages which are necessary to compile a required program.
- gcc – GCC stands for GNU Compiler Collection, a compiler system for various programming languages. It is mainly used to compile C programs.
- g++ – This package is a GNU compiler specifically made for compiling C++ programs.
- libc6-dev – This is GNU C Library and contains Development Libraries and Header files for cross-compiling.
- make – It is used to direct the compilation of programs. It interprets the file called “makefile” that directs our compiler on how it should work.
- dpkg-dev – This package is generally used to unpack packages but also provides functionalities to build and upload Debian source packages.
When you install build-essential packages on your Ubuntu system, it gives you almost everything you required to compile basic C and C++ software on Ubuntu.
You can also install these packages individually if you have some of them installed on your system. However, a build-essential meta-package makes your job easy by providing you with all the necessary tools at one-stop
How to install build-essential on Ubuntu?
Open your default Terminal by pressing Ctrl + Alt + t and enter the following command:
sudo apt update
This command will update all the PPA indexes which are helpful to install new packages with the most recent version. You will be required to enter your password and then hit enter
Now, run the following command to install the build-essential tool:
sudo apt install build-essential
Congratulations! Build-essential meta-package has been installed on your Linux System.
How to remove the build-essential meta-package from Ubuntu?
Keeping a build-essential meta-package won’t harm your system but if you are running out of storage you can easily remove the build-essential meta-package by given instructions.
Use the following commands to remove the build-essential meta-package from your Ubuntu system:
sudo apt remove build-essential
Hit Enter when you are asked to make a choice (If you hit Enter, yes will be chosen as the default option)
You can also remove unnecessary dependencies for build-essential which are no longer required by using the following commands:
sudo apt autoremove
Note: While installing packages using build-essential, you will have to make sure that all the dependencies are installed on your system. If you won’t have enough dependencies to run a particular program, the chances of that package won’t run are high.
So it is a good practice to read all the dependencies before installing or running that particular software.
Linux is all about choices and it gives us lots of distributions to choose from. There are several Linux distros with different package managers which means there will be different ways to manage packages on each of them.
By building an application from the source, you can have relief from learning a new way to install the software.