There are typically four parts to install a program from a tar file or a tarball.
- Extraction
- Configuration
- Compiling/Building Executable
- Installation
Step1: Extraction
Here we extract the archive file. The process is similar to the extraction of od Zip/Rar file using WinZip or WinRAR in the windows environment, we extract the tar file using the following command in terminal.
tar -xvf filename.tar
Basic options:
- x --> extract, --get — extract files from an archive;
- v --> verbose — shows a list of processed files.
- f --> file — specify the archive's name
This syntax is universal and applies to all tar files, however, If the tar file has been compressed using a compression software then depending upon the compression software we need to add an extra alphabet to our command syntax.
Compression | File Extension | Option | Command |
gzip | .tar.gz, .tgz | z | tar -xvzf filename.tar |
bzip | .tar.b2, .tar.bz, .tar.bz2 | j | tar -xvjf filename.tar |
xz | .tar.xz, .txz | J (uppercase) | tar -xvZf filename.tar |
LZMA {7zip} (from 1.2.0 onwards tar support) | .tar.lz, .tar.lzma, .tlz | --lzma | tar --lzma -xvf filename.tar |
Step2: Configure
In this step we run the configure script that you will find in the extracted folder, However, there can be exceptions, in that case, you may not find the configure script. but can proceed with the next step. In fact, there may be cases where mere extraction of the tar is required. which will give the executable that you can run to start the program.
./configure
when we run configure script it checks if the accessory dependencies required for installing the program and is available or not.
Step3: Building Software
Here we run the make command, a universal command available in all Linux distributions. This command takes in the make file which is present in the same directory to build the final finish program from the source code, now this command compiles your program code and creates the executable
make
Step4: Installation
We execute the make install command in the terminal, In the 3rd step we build the software the executable was created in the temporary directory, Now this command will make our executable to the required directory.
make install