Menu

For Geeks

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:

‘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

Compile:

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

./configuremake

./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.

Install:

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.