Install build-essential on Ubuntu | Complete Guide
To install the build essential on your Ubuntu system, use the apt install
command:
sudo apt update
sudo apt install build-essential
Along with build-essential
, you’ll likely also want to install dkms
(Dynamic Kernel Module Support). This provides the header files necessary for compiling software that interacts with the kernel, such as device drivers or kernel modules.
sudo apt install dkms
You should also install the linux-headers
package.
sudo apt install linux-headers-$(uname -r)
Why Install build-essential?
In Ubuntu Linux, the build-essential
package is a meta-package that contains a collection of essential software tools and libraries needed for compiling software from source code.
When you install build-essential on Ubuntu, it install following key components:
- gcc (GNU Compiler Collection) – for compiling C programs
- g++ (GNU C++ Compiler) – for compiling C++ programs
- make – a build automation tool
- dpkg-dev – tools for building Debian packages
- libc-dev – standard C library headers and development files
What is dkms in Ubuntu?
DKMS stands for Dynamic Kernel Module Support. It’s a framework within Linux that allows you to build and install kernel modules, and then automatically rebuild them when you update your kernel.
Why Use dkms?
- Automatically recompiles kernel modules when the kernel updates.
- Useful for third-party drivers like NVIDIA, VirtualBox, and Broadcom Wi-Fi drivers.
- Avoids manually reinstalling drivers after each kernel update.
What is linux-headers in Ubuntu?
linux headers that provide header files to understand how to interface with the kernel when Compiling kernel-related software.
Why Install linux-headers?
- Required for compiling kernel modules (e.g., NVIDIA, VirtualBox Guest Additions).
- Needed when using DKMS to maintain out-of-tree kernel modules.
- Essential for developing kernel-related applications.