Linux is the operating system with more kinds of packages. Surely, if you have used Debian, you should know the file type .deb or maybe, if you have used Fedora, you should know the file type .rpm. In Linux, we have a lot of file types when we talk about installation packages, and surely, you know the format .tar.gz.
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 with a compression method, such as gzip, to create a compressed archive as well as 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 bit long and tougher.
If you need to install a .tgz package, don’t worry, we have the solution and you’re going to know it through an example:
I need to use WaoN because I play the guitar and I 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 I have extracted the tarball’s content.
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:
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:
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.
To build a package you must use the program make: make -arguments
More about make here.
Finally, I get an executable file:
Now I must execute my program. In most cases you’ll install the program in your computer, so you must use the command ‘make install’.
Another 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).
It takes the same process, extracts the file.
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
Finally, execute the program. There many possibilities when you install a tarball package. So you must analyze your situation and install your package; it’s easy, just pay attention to your package. Also, when you use .configure command, if you have any dependencies issue, you'll be asked to install the dependencies.
That's all there is to install a .tar.gz or .tgz files in Linux. If you have any problem installing the packages through this method, let me know in the comment section below. I'll help you out.