How to Install Linux Software From Source

Building apps from source is simpler than you think

The Linux operating system offers unrivaled flexibility. One area that highlights this is the installation of software. On either the Linux desktop or server, there are a few ways to install applications. For most users, the easiest route is through the distribution app store (such as Ubuntu Software and KDE Discover). Another easy method is the command line package manager. Following that method is the less-than-friendly method, installing from source.

Why Install From Source

There are a few reasons to install from source:

  • The app install isn't available in the distribution package manager.
  • You want to install an app with specific features or modules that aren't built into the packages found in the distribution package manager.
  • There's a newer version of an app (available as source) not found in the distribution package manager.
  • You want to work your way up to compiling a Linux kernel.
  • You might find yourself trapped in a dependency nightmare.
  • When software is installed from source, the distribution package manager may not be aware of it (which means, if another app depends on the source-installed software, it won't know it's there).
  • There's no easy route to updating the software (without reinstalling).

There are two main reasons why installing from source can get complicated:

Every application has dependencies required for installation. Unless those dependencies are met, the application won't install. These dependencies can be a problem to install. This is the biggest issue for most new Linux users. Because of this, it is recommended to first look for the app in the distribution app store.

The second reason is the language the app is written in determines how the app is installed. Some languages (such as Go) are installed using a different method than traditional languages (such as C and C++). Some source-installed applications require a third-party app for the installation.

How to Install From Source

Here's how to install an app that was written in a traditional language. The app is the QMMP music player (a throwback to Winamp). Although it's possible to install QMMP from the distribution package manager (by way of a third-party repository), it can also be installed from source.

QMMP can be installed on Ubuntu Desktop 18.04 with a minimal amount of dependency resolution. Other distributions require you to install more software to install the app from source successfully.

  1. Install the Subversion tool. To do this, open a terminal, then issue the command:

    sudo apt install subversion -y
    Screenshot of install subversion.

    QMMP uses Subversion, but other apps use the Git version control software. We have a separate Git guide dedicated to working with it.

  2. Once Subversion has been installed, checkout (download) the source from the QMMP site. This is done with the command:

    svn checkout http://svn.code.sf.net/p/qmmp-dev/code/branches/qmmp-1.3
  3. Change to the new directory with the command:

    cd qmmp-*

    That directory contains a README file that outlines the process of installing the app. The README file lists the requirements that must be installed before QMMP can be installed. Depending on the distribution, some tools might be installed by default. For example, on Ubuntu Desktop 18.04, the only dependencies that aren't installed are Qt and Qt Dev Tools. You can install those packages, manually, using the distribution package manager.

    With every application installed via source, the to-be-installed dependencies vary, based on the distribution. When following the below instructions, if you find the first command reports missing dependencies, those must be installed manually. This is why it is crucial to read the README file before you begin the source installation.

  4. Use a configure command to create a file that instructs the build tools about the environment and other specifics. In the case of QMMP, the configure command is cmake. To do this, issue the command:

    cmake ./
    Screenshot of the cmake ./ run.
  5. When that completes, you're ready to build the application. To build the application, issue the command:

    make
    Screenshot of the running make command.

    Some applications allow you to build in specific modules and features during the configuration phase. If there are specific modules or features that can be added during the configuration step, these are outlined in the README file.

  6. This should complete without any errors and create binary executables that can then be installed in the proper directory.

  7. To install the application (which, at this point, is copying the necessary files into the proper directories), issue the command:

    sudo make install
    Screenshot of running the make install command.
  8. Once that command completes, run the QMMP music player from your desktop menu.

    Screenshot of QMMP now installed.

Every source installation differs based on how the application developer created the software. For example, some software includes a configuration script that is run with the command ./configure (instead of the cmake ./ command).

Always read the included README file before attempting to install the application from source.