How To Install a Package From .tar.gz Or .tar.bz2 File In Linux?

How To Install a Package From .tar.gz Or .tar.bz2 File In Linux?


This post was last updated on October 25th, 2020 at 10:02 am

A file archiver is used to hold multiple files into a single archive file. And a file compression utility is used to reduce the size of these files. Archiving and compressing files makes file handling easier and faster to transmit over the network or internet.

Linux provides various archiving tools one of them is tar. Also, it provides file compression tools such as gzip, bzip2, xz, lzma, etc. These archiving and compression tools are used together to distribute software packages in Linux.

Generally, this archive contains the source of the package and each of them follows a different approach to install. In this article, we will discuss a command method to install software from .tar.gz or .tar.bz2 package.

How to Extract .tar.gz package

Suppose we have a package named package-1.2.3.tar.gz and we have to install it. To install this package first we need to extract it. Follow the below steps to extract it-

1. Open your terminal by pressing ctrl+alt+t

2. Navigate to the location where package-1.2.3.tar.gz is saved suppose it is in downloads directory then use –

cd Downloads

3. Now run the following command to extract it –

tar xzvf package-1.2.3.tar.gz


x- Extract

z- Type of compression i.e. gzip

v- Verbose

f- Next comes the filename

How to Extract .tar.bz2 package

Similarly, if you have a package named package.tar.bz2 then to extract it first open your terminal and navigate to the correct directory where the file is located. And then run the following command to extract it.

tar xjvf package-1.2.3.tar.bz2

Where option j is used for bzip2 compression.

Install the extracted package

Now first move to the extracted directory named package-1.2.3

cd package-1.2.3

Make sure to read a file with the name INSTALL.txt or README. You can check these files by using ls command in your terminal. Use the following commands if –

1. You find a file named configure then use –


If fails to execute provide the executable permission to it with –

chmod +x configure

And the execute

sudo make install

You may also need to install some dependencies if, for example, running configure can prompt you with an error listing which dependencies you are missing.

2. And if you find a file named then use –



sudo ./

3. You find the file named then use –



sudo ./install

4. If there is no configure file then use –

sudo make install

5. If you still can’t find the required files for installation then move to a special directory named bin and repeat the same process.

We recommend you read INSTALL.txt or README which contains the complete instruction on how to install the particular package. You should read this because there could be different instructions available for the proper installation of that file.

Now I hope by using the given steps you are able to install the software in your system. Still, if you find a problem while installing the software then don’t forget to write us in the comments below.

Previous What Is A Virtual Terminal In Linux/Unix?
Next How To Run A Process In Background In Linux/Unix?

About author

You might also like

Linux Topics 0 Comments

Understanding the Filesystem (Directory Layout) In Linux

This post was last updated on August 1st, 2020 at 12:58 pmEvery computer stores various types of data on a storage device such as hard disk, USB drive, etc. This

Linux Topics 0 Comments

How To Open A Directory with Root Privileges In Ubuntu 20.04 LTS?

This post was last updated on August 29th, 2020 at 08:31 pmIn Linux or Unix, you can perform almost any task by using a terminal. You need to have superuser

Linux Topics 0 Comments

Package Management In Debian(.deb) Based Linux Distributions

This post was last updated on August 3rd, 2020 at 03:04 pmContents1 Software Package2 Package Manager3 Advanced Packaging Tools (apt)3.1 apt-get Commands-3.2 apt-cache Commands-3.3 Difference between apt and apt-get commands-4


No Comments Yet!

You can be first to comment this post!

Leave a Reply