How to Compile and Install .tar.gz or .tar.bz2 Source Package on Debian and Ubuntu

How to Compile and Install .tar.gz or .tar.bz2 Source Package on Debian and Ubuntu
How to Compile and Install .tar.gz or .tar.bz2 Source Package on Debian and Ubuntu

How to Compile and Install .tar.gz or .tar.bz2 Source Package on Debian and Ubuntu

In this article i will show you how to install packages using source archive on Ubuntu systems.

Prerequisites

Firstly you need to prepare your system with requirements for compilation.

$ sudo apt-get install apt-file autoconf build-essential checkinstall

Extract Source Package

Firstly download the source archive on your system and extract it. Mostly users select home directory, /opt or Desktop for extracting package but we prefer to use /usr/local/src/ directory for extracting source of packages.

user@TutorialsSpace:~# sudo  cd /usr/local/src/

user@TutorialsSpace:~# sudo  tar -xzf myapplication-1.1.tar.gz

or
user@TutorialsSpace:~# sudo  tar -xjf myapplication-1.1.tar.bz2

Compile and Install from Source

Now navigate to extracted directory and look for one of files INSTALL or INSTALL.txt or README.

user@TutorialsSpace:~# sudo  cd /usr/local/src/myapplication-1.1
These files contains the compilation steps for that source application. If you do not found them, Most of applications can be compiled using following commands.
[simterm]user@TutorialsSpace:~# sudo  ./configure
user@TutorialsSpace:~# sudo make
user@TutorialsSpace:~# sudo make install

You may also need to install some dependencies if, for example, running configure prompted you with an error listing which dependencies you are missing. You can also use checkinstall instead of make install.