.tar.gz file format is a tar archive that has been compressed with gunzip compression. These archives are designed to be opened on Linux systems and can contain any type of files within them. Sometimes, software comes packaged in a
.tar.gz file, and users can extract its contents in order to install what is inside.
Normally, software comes in the form of a compressed archive whenever it is to be compiled from source. Whereas distributable binaries are normally installed through other means, such as via the system’s package manager. In this tutorial, we will go over the step by step instructions to install software from a
.tar.gz file on a Linux system.
In this tutorial you will learn:
- How to extract content from a compressed tar file
- How to install prerequisite packages to build from source
- How to configure, make, and install source files
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Software||tar, gzip, development tools|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
To install software from a compressed archive, we will need the proper tools to extract the files and to compile the source code. We can use our system’s package manager to install these tools by executing the appropriate command below.
$ sudo apt update $ sudo apt install tar gzip build-essential
$ sudo dnf groups mark install "Development Tools" $ sudo dnf groupinstall "Development Tools" $ sudo dnf install tar gzip
$ sudo pacman -Sy base-devel tar gzip
Install software from .tar.gz
The recommended way to install software from source is to check the README file or official website for instructions. They may tell you to execute certain commands or include particular options, and may also reveal other prerequisite packages that are needed for installation in addition to the ones we showed you above.
With the disclaimer above out of the way, keep in mind that different packages may require a different set of instructions for installation. We will run through the most general steps that the majority of software packages follow for installation:
- Start by extracting the contents of your archive.
$ tar xf software-name.tar.gz
- Change into the extracted directory, and see if there is a file that we can execute named
configure. If so, execute it and follow the instructions on screen (if any).
- Next, use the
makecommand to build and compile the software from the included source code files:
- Then, to install the software on your system, run the following command. This part will require root permissions as we are installing software on the system.
$ sudo make install
In this tutorial, we saw how to install software from a
.tar.gz archive on a Linux system. Software source files are normally distributed this way, and require the user to build and compile the code before finally installing it on the system. Various software will require a unique set of instructions, but in general, most software installation will follow the steps shown above, and sometimes with slight differences that may or may not have an impact on the final result. Definitely make sure you consult the readme file or official instructions for the exact process.