How to Install a .tar.gz (or .tar.bz2) file?

Once I downloaded a software package and then I was wondering to install that package. As when I was using Windows OS and if I wanted to install any application, I used to double-click the .exe file and next -> next -> next ->installed. In Linux, there is the only way known to me that install directly from the source. But like Windows, there is also a step-by-step method to install an application in linux. Read the following post to know how to do that.

While yum, apt-get, rpm terribly handy to put in a package that’s already compiled, you continue to may encounter some things wherever you have got to install a software package from file. In this post we are going to see how to install software from the source file.

Download the Source File Package and Extract it

If you want the source file for any application in Linux then you find it in compressed tar files which usually have either .tar.gz or .tar.bz2 extensions. The tools that are used to pack the source file into the tar files are ‘tar‘ (used to combine multiple files into one) and ‘gzip‘ or ‘bzip2‘ (used to compress). Now, to get the source file for a particular application you need to know the URL for that tar file.

When you get the URL, fetch the tar file from command line by using ‘wget‘:

$ wget <URL_of_the_tar_file>

This command will download the tar file from the URL into the current directory.

Now, you need to extract the tar file in order to get access to the source code and other files. The following command depends on the extension of file downloaded,

$ tar -xvfz <tar file with .tar.gz extension>


$ tar -xvfj <tar file with tar.bz2 extension>


Now we move forward and configure the environment to compile and install the software on our Linux system. The file name of configuration file is generally ‘configure‘. The script typically accept parameters that are used to control features of this application and also makes sure that all the tools required for this application are present in this system.

You have to execute the following command to start the environment to build,

$ ./configure

This command can check or create the build environment and if everything goes smooth then it produces file known as ‘makefile‘ which is used to compile the application.


Run the following command in the same directory when the ‘makefile’ is produced,

$ make

This compiles the source code related to the application and if it encounters any problem, the error will be shown up on the console.


Once the compilation is finished with success then all the desired binaris are created. Now’s the time to install these in the standard paths so that they will be invoked from anyplace within the system. Run the subsequent command to do this,

$ make install

Now sometimes while installing the application might need root privileges, thus one might gain the rights by the following command and then proceed with the above command

$ sudo su

So the above steps make you install the package from the source file manually which includes fetching, extracting, configuring, compiling and installing the application. Now, if any error you face comment it below, I will try to rectify it.

Be the first to comment

Leave a Reply

Your email address will not be published.