How to install .tar.gz and other tarball files in Linux

Tar.gz, .tgz, tar.bz2, .tbz2 are compressed tarball files which contains source code of the application. Tarball is used largely in Linux and is parts of GNU project. Most of the applications source code are available in tar files. The installation of file from the source can be complicated at first glance but you will find it completely sophisticated once you are used to it. It is extremely important to understand the installation method because some of the application doesn’t provides the package format for particular distros. Meanwhile, it also gives your brief overview of the organization of files in Linux and how installation works in Linux. Tarball is supported by every Linux distribution.

Extract tarballs:

To extract various tarball files, run the following commands:

tar xvzf file_name.tar.gz

tar xvzf file_name.tgz

tar jxf file_name.tar.bz2

tar jxf file_name.tbz2

‘v’ is optional. If you want to see  the files being extracted use ‘v’ otherwise don’t.  For example, To extract this file “android-sdk_r18-linux.tgz “, I would type:

tar xvzf android-sdk_r18-linux.tgz


To compile the file, change to the extracted directory using cd command. Then type:


./configure command make sure that the system has all the library files that are required to install the file. If the library are not available, it will show the error. You can then install the library from the repository and try again. While configuring you can mention the path of binary file installation path as:

./configure --prefix=/usr/bin/hello

This will install the binary file later in the hello directory under usr/bin.

make command compiles the source files into executable binaries.


To install type:

make install

This command will install the binary file into your Linux machine.

Final Conclusion: All the source or tarball files have the README file which consist of the installation instructions. To compile and install the tar ball files all the library dependencies needed, should be installed. Before installing source files it’s always a good idea to read the installation instructions under README file.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s