Master the full source compilation workflow: downloading tarballs, running ./configure, understanding Makefiles, compiling with gcc/make, installing, and managing library dependencies with ldconfig and pkg-config.
Linux package managers (apt, dnf, pacman) are the preferred way to install software. They handle dependencies, security updates, and clean removal. However, there are valid reasons to compile from source:
Source-compiled software does NOT receive automatic security updates. You are responsible for monitoring for new versions and recompiling. This is why package managers are strongly preferred for production systems unless there is a specific compelling reason.
Download a tarball from the official site, or clone a git repository.
wget https://example.com/app-1.0.tar.gz git clone https://github.com/user/appExtract the archive and read README, INSTALL, and NEWS files to understand build requirements.
tar xzf app-1.0.tar.gz && cd app-1.0The configure script checks your system for required libraries and generates a Makefile tailored to your environment.
./configure ./configure --prefix=/usr/localInvokes the compiler (gcc) according to the Makefile rules. Binaries appear in the source directory.
make make -j$(nproc)Copies binaries to system paths (/usr/local/bin). Installs man pages. Usually requires root.
sudo make installRemove source directory and tarball. Verify the installation.
which app app --versionThe configure script is generated by autoconf. It performs a series of system checks: compiler availability, library headers, function availability, and system capabilities. The output is a Makefile and a config.h header file.
When ./configure fails with "library not found," the library package is installed but its development headers are missing. On Debian/Ubuntu, install the -dev variant of the package. On RHEL/Fedora, install the -devel variant. The runtime library and the development headers are separate packages.
The -j flag enables parallel compilation — on a 4-core machine, make -j4 compiles four source files simultaneously, dramatically reducing build time for large projects.
checkinstall is a tool that intercepts make install and creates a proper distribution package (.deb, .rpm, or .tgz) instead of installing files directly. This makes the software trackable and removable by your package manager.
The complete safe workflow: (1) read README, (2) install build dependencies, (3) ./configure --prefix=/usr/local, (4) make -j$(nproc), (5) make test, (6) sudo checkinstall (preferred) or sudo make install, (7) update ldconfig if you installed shared libraries, (8) verify with which and --version, (9) clean up source directory.