When should one compile and install from source

compilingsoftware installationsource

To install software on a Linux system, many tools like yum, apt-get, rpm, dpkg and so on are available to either fetch a package from a repository or install a downloaded package.

Alternatively, it is possible to download a (typically) .tar.gz2 archive of the source and compile manually using

./configure
make
make install

or similar. My question is: When should one compile and install from source?

Best Answer

In general it is recommend to use the packages coming by your distribution and using the related package manager (e.g.dpkg/apt-get on Debian-based system). The task of your distribution is to package software and to configure it such that there are no conflicts.

Sometimes your distribution does not have the software you want or you have other reasons like e.g.

  • you need a newer version
  • you want to have a special configuration or want to include patches etc.
  • you need more performance and therefore want to optimize the software especially for your hardware (processor, ...)

because you want to compile the software yourself (which can be become quite difficult - especially if you do not know all dependencies).

You have then different options:

  • rebuild it from the source, usually from a tarball (= *.tar.gz file) or from an upstream source repository like github
  • download/install a corresponding pre-built package (directly or by using an unofficial repository)
  • use the existing package source from your distribution, update it by hand and create a new package which you then can install.

If you install software not using the package manager, it is strongly recommended to install the software to other places than the package manager use. The destined prefix is /usr/local/. Installing into a new subdirectory of /opt or somewhere in your home folder are also options.

Related Question