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
Where,
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 –
./configure
If fails to execute provide the executable permission to it with –
chmod +x configure
And the execute
make
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 install.sh then use –
./install.sh
or
sudo ./install.sh
3. You find the file named install.sh then use –
./install
or
sudo ./install
4. If there is no configure file then use –
make
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.