Building and Installing Software from Source on Linux

Not everything is available as a package for your distro — building from source is a fundamental Linux skill, and the classic pattern is more predictable than it might seem.

# The classic three-step pattern for most C/C++ projects
./configure --prefix=/usr/local
make -j$(nproc)          # parallelize across all CPU cores
sudo make install

# CMake-based projects follow a similar but distinct pattern
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo make install

Before Building: Install Build Dependencies

# Debian/Ubuntu: pull the dependencies a distro package would have needed
sudo apt build-dep some-existing-package

# Or install the generic build toolchain
sudo apt install build-essential

Keeping Track of What You Built

Software installed via make install isn’t tracked by your package manager and won’t show up in apt list --installed — worth using checkinstall (which wraps make install and creates a real, removable .deb/.rpm package) if you’re building something you’ll want to cleanly uninstall later.