Compiling Software from Source

Compiling applications from source is not that difficult. Most source code is available as compressed source tarballsthat is, tar files that have been compressed using gzip or bzip. The compressed files typically uncompress into a directory containing several files. It is always a good idea to compile source code as a regular user to limit any damage that broken or malicious code might inflict, so create a directory named source in your home directory.

From wherever you downloaded the source tarball, uncompress it into the -/source directory using the -c option to tar:

tar zxvf packagename.tgz -C -/source tar zxvf packagename.tar.gz -C -/source tar jxvf -C -/source tar jxvf packagename.tar.bz2 -C -/source

If you are not certain what file compression method was used, use the file command to figure it out:

file packagename

Now, change directories to -/source/packagename and look for a file named readme, install, or a similar name. Print out the file if necessary because it contains specific instructions on how to compile and install the software. Typically, the procedure to compile source code is as follows:


This runs a script to check whether all dependencies are met and the build environment is correct. If you are missing dependencies, the configure script normally tells you exactly which ones it needs. If you have the Universe and Multiverse repositories enabled in Synaptic, chances are you will find the missing software (usually libraries) in there.

When your configure script succeeds, run make to compile the software. And finally, run the following:

sudo make install

If the compile fails, check the error messages for the reason and run make clean before you start again. You can also run sudo make uninstall to remove the software if you do not like it.

Was this article helpful?

0 0

Post a comment