Site icon LinuxAndUbuntu

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

How To Install .tar.gz Or .tgz Packages In Linux

How To Install .tar.gz Or .tgz Packages In Linux

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.

​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 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).

​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 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.

Exit mobile version