How to Install Linux Software From Source

Yes, you can do it


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

There are a few good reasons why you might want to install from source.

  • The app you want to install isn’t available in your distribution package manager.
  • You want to install the app with specific features or modules that aren’t built into the packages found in your 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 your own 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 upon 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:

  • Dependencies
  • Programming language

Every application will have dependencies required for installation. Unless those dependencies are met, the application will not install. These dependencies can be a real problem to install. This is the biggest issue for most new users of Linux. Because of this, it is always recommended to first look for the app in question in the distribution app store. Dependencies can be a nightmare.

The second reason is the language the app was written in will determine how the app is installed. Some languages (such as Go) are installed using a different method than traditional languages (such as C or C++). Some source-installed applications will even require another third-party app for the installation (so it can get really tricky). Let’s take a look at how to install an app that was was written in a traditional Language. The app in question is the QMMP music player (a throwback to Winamp). Although it is possible to install QMMP via the distribution package manager (by way of a third-party repository), we’re going to demonstrate install it via source. Fortunately, QMMP can be installed on Ubuntu Desktop 18.04 with only a minimal amount of dependency resolution (whereas with some other distributions, you might have to install far more software, in order to successfully install the app from source). Here are the steps for installing this app, via source.

  1. In order to download the source, the Subversion tool must be installed. To do this, open a terminal and issue the command sudo apt-get install subversion -y.

    Screenshot of install subversion.
  2. Once subversion has been installed, you must then checkout (download) the source from the QMMP site. This is done with the command:

    svn checkout qmmp-1.2
  3. Change into the newly created directory with the command cd qmmp-*. In that directory you will find a README file that outlines the process of installing the app. Within that README you’ll see a number of requirements that must be installed, before QMMP can be installed. Depending upon the distribution you are using, some of these 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 each of those packages, manually, using the distribution package manager, like so:

    The README is Crucial

    You will find, with every application being installed via source, that the to-be-installed dependencies will vary, based on the distribution the app is being installed onto. When following the below instructions, if you find the first command reports more missing dependencies, they will have to be installed manually. This is why it is crucial to first give the README file a look, before you begin the source installation. That README file should always be considered the first step for source installation.

  4. The next step is to use a configure command, which will create a specific file that will instruct the build tools about your environment and other specifics. In the case of QMMP, the configure command is cmake. To do this, issue the command cmake ./. When that completes, you’re ready to build the application.

    Screenshot of the cmake ./ run.

    Building Modules

    Some applications allow you to build in specific modules and features during the above configuration phase. Once again, this is where the README file comes in handy. If there are specific modules/features that can be added during the configuration step, they will be outlined within that file.

    Screenshot of the running make command.

    To build the application, issue the command make. This should complete without any errors and create binary executables that can then be installed in the proper directory.

    Screenshot of running the make install command.

    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 QMMP now installed.

    Once that command completes, you should be able to run the QMMP music player from your desktop menu.

  5. Enjoy your new application, installed via source.

Read the README

As mentioned previously, it should be said that every source installation will differ, based on how the application developer created the software. For example, some software will include a configuration script that is run with the command ./configure (instead of the cmake ./ command). Again, it is important to always read the included README file, before attempting to install the application from source.