How to Extract and Install .tar.gz Files in Linux

sohail
sohail

Table of Contents

Linux is the operating system with more kinds of packages. If you have used Debian, you should know the file type .deb. If you have used Fedora, you should know the file type .rpm. In Linux we have many file types when we talk about installation packages and surely you’ll learn to install .tar.gz packages.

What is .tar.gz or .tgz?

​Tar isn’t an installation package but a computer software utility for collecting many files into one archive file. It is often referred to as a tarball for distribution or backup purposes. So .tar.gz is just a file format.Tar is often used together with a compression method, such as gzip, to create a compressed archive and file.tar.gz (or file.tgz).

Tarballs are often used to distribute the source code of an application or maybe a binary file to execute a program. You should consider finding an alternative before installing a tar.gz package because sometimes the process is longer and tougher.

How to install .tar.gz or .tgz file in Linux

If you need to install .tar.gz or .tgz package don’t worry, we have the solution.

I need to use WaoN because I play the guitar and want to transcribe the audio to a midi file, but WaoN isn’t available for my distro. So I have downloaded the source code to my computer, and the tarball’s content.

extract tar.gz or tgz file in linux

​To extract the files of a tarball, you can use the command: tar xvf tarball.tar.gz. Also, you should find more information about Tar here.

Now enter into the extracted directory:

cd into the tar extracted directory

​Commonly the tar.gz package contains a file with the instructions to compile and execute the program. My package contains a file called ‘INSTALL’ with the instructions:

read text file using cat command

​In other cases, you’ll find a ‘configure’ script. This script is a tool to check if your system has all the dependencies required for the building. If you find a ‘configure’ script, you must execute it: ./configure (also, you should check the file permissions).

If the output of the ‘configure’ script doesn’t report any problem, you can continue with the next step.

install .tar.gz program in linux

​To build a package, you must use the program make: make -arguments. More about make here.

Finally I get an executable file:

install executable file in linux
compile tar.tgz package in linux

​Now I must execute my program. In most cases, you’ll install the program on your computer, so you must use the command ‘make install’. Other tarball packages contain a binary file, for example:

Sublime Text is available for Ubuntu, but it doesn’t provide a version for my distro, so I have to use the tarball version (the file type isn’t tgz, it’s a tar.bz2 file).

check and install .tar.gz file in linux

​It takes the same process, extracts the file.

extract tar file in linux

I found the executable file of sublime text, but I checked the file permissions to execute the file. If your file doesn’t have permissions, you can modify the permissions using chmod

sublime text editor in linux

​Finally execute the program. There are many possibilities when you install .tar.gz package. So you must analyze your situation and install your package. It’s easy, pay attention to your package.

When you use the ./configure command, it will prompt you to install any dependencies. That is all there is to installing .tar.gz or .tgz files in Linux. If you have any problems installing packages using this method please let me know in the comments section below.

Linux TutorialsUncategorizedhow-to