How to Install Software from Source Code on Linux

September 10, 2016 by No Comments

While yum, apt-get, rpm are very handy to install a package that is already compiled, you still might encounter some situations where you have to install a software from source code. This article explains how to compile and install software from source code.

If you’ve downloaded a source code archive, you’ll have to compile it before you can install it. In the top level directory of your extracted source, there is usually a README or INSTALL file that gives you instructions on how to compile and install the package.

A typical installation procedure from a source package looks something like this.

Download the Source Code Package and Unpack it

$ wget <link to the tarball>
$ tar -xvfj <name of tarball with tar.bz2 extension>

To learn about the options provided by a specific configuration file, run the following command:

$ configure --help

Configure Options

If you need to install the software in a custom location other than normal location, then we can use the “prefix” option. For example the server administrator needs to run different versions of same software on same server, we can use this option to make it work.

  --prefix=PREFIX         install architecture-independent files in PREFIX

To start configuring the build environment, execute the following command :

$ ./configure

The above command will check and/or create the build environment and if everything goes fine then it produces a file called ‘makefile’. The file ‘makefile’ is used in the compilation of the software.


Once the makefile is generated, then in the same directory just run the following command:

$ make

The above command will compile all the source code related to the software. If compilation encounters some problem then error is thrown on the console.


Once the compilation is done successfully then all the required binaries are created. Now is the time to install these binaries in the standard paths so that they can be invoked from anywhere in the system.

To do this run the following command :

$ make install

Note that some times installing the software may require root privileges, so one may gain the rights and then proceed with the above command.

Advantages of installing from source:

  • You can install the latest version and can always stay updated, whether it be a security patch or a new feature.
  • Allows you to trim down the features while installing so as to suit your needs.
  • Similarly you can add some features which may not be provided in the binary.
  • Install it in a location you wish.
  • In case of some software you may provide your hardware specific info for a suitable installation.

In short installing from source gives you heavy customization option at the same time it takes a lot of effort, while installation from binary is easier but you may not be able to customize as you wish This resource. Building from the source allows to specify architecture of exactly your machine click here. New CPUs have additional instructions that compilers do understand, squeezing out a little bit of performance. Pre-build packages usually count on the most archaic CPU still in common use.

Installation using package manager like rpm or .deb files

A package (RPM or DEB for example) is the binary executable (or interpreted script etc) pre-prepared for your particular distro.

  • They are much easier to install
  • Specifically designed to work with your distro
  • Sometimes patched by the package maintainer to fix distro specific bugs
  • The package manager will uninstall them
  • It will manage all dependencies for you
  • It will take care of updates
  • You don’t need to install developer tools on your system (compilers, make etc)

However, sometimes the packaged version is an old version or even worse, there is no packaged version; in which case your only option is to compile yourself.

If you decide to compile a program by yourself, you need to think that compiling is not something you do only once. You will probably need to subscribe to the development mailing list of the applications you decided to compile and stay up to date with the new versions and, especially, the security updates at billigaste mobilabonnemang.

Every time the application is updated you will have to recompile the new version so, just keep in mind that you will have to spare some of your time every week.

If you cannot afford that, it is better to let the package maintainer do that job for you.