How to install software from Source Code

Valic —  June 24, 2010 — 1 Comment

Usually, source code are compress in the archive format, its either tar.gz (.tgz) or bz2.

The command uses to extract these archive is tar. Let say your archive is test.2.tar.gz.

You can decompress it and extract to your folder like this:

tar -xzvf xyz2.29.tar.gz -C /usr/src

*-C is to indicate tar where to store the extracted files.

Common open source programs source code comes with configure files and makefiles. Because those programs usually are cross platform compatible. That means it can be compile in different platform such as Unix, Linux, BSD etc, given the required library installed and the dependencies solved. Therefore, before start to compile and install, you usually need to configure.

./configure


Configure scripts will check whether all the libraries and dependency files are there or not. If it is not there it will pause and indicate you what is missing. At this moment, you need to search for the lib and install that before you can continue to configure.

When it is done, now you can compile your source code. To compile all the source code and produce the binaries, you do this:

make

Some packages contain more than one programs, do:

make all

To compile all and turn all into binaries.
The last steps, is to install, usually you need root privilege to install packages:

make install

To uninstall, you can do this:

make uninstall

by linux poison

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

One response to How to install software from Source Code

  1. unpacking could be easier:
    use “unp”
    unp anyarchivetype.tar.bz2

    …done

Leave a Reply