In this article, we’re discussing how to install an application contained in a .tgz file. Before we begin, note you are not installing the actual .tgz file, itself, rather you are compiling the source code of the application contained within the .tgz file through a series of commands.
We are using Zorin OS 16, an Ubuntu-based distro, for this guide. All of the Linux commands featured in this article are distro-independent, meaning they will work on any Linux distro.
What Is a .tgz File?
Most of the file types listed can also be also by uncompressed via the tar command or the Archive Manager. The Archive Manager is a preinstalled GUI utility available on Linux distros utilizing the GNOME desktop environment.
There are two ways to open a .tgz file, either from the command line or using the Archive Manager. However, you shouldn’t use the Archive Manager to open a .tgz file, as you need the command line to run a number of script files contained within the .tgz files to actually install the application.
How to open and install a .tgz File
- Download the required .tgz file to your system. Launch the terminal and navigate to the location of your .tgz file.
- Extract the .tgz file using the tar command.
# tar -xzfv application_name.tgz
Note the options ( -xzfv) we used with the tar command.
- The -x option – extract the .archive file.
- The -z option – filter the archive through gzip.
- The -f option – the filename of the archive file.
- The -v option – show the progress of the extraction.
- Next, navigate to the newly-created directory where the .tgz file was extracted to.
# cd application_directory_name
- Then run the configure command to configure the source code so that it can be compiled on your system. You may be asked some questions about how you want to build the application during this process, also.
- Now, invoke the make command to compile the source code. Note that this process could be lengthy if compiling a large application.
- Finally, run the make install command to copy the code you compiled into the Linux OS so that it can be executed.
# make install
Example Installation – wmx-8
In our example, we’ll be installing wmx-8, a window manager for X.
- Download the wmx-8.tar.gz file to the /tmp directory.
- Extract wmx-8.tar.gz.
# tar -xzfv wmx-8.tar.gz
- Change directory to /tmp/wmx-8.
# cd /tmp/wmx-8
- Configure the source code to make it ready to compile.
- Compile the source code.
Normally, we would run make install after this, but it’s not necessary in this case as the make command did it for us.
Linux Commands Used In this Article
- sudo – allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.
- cd – change the working directory.
- tar – an archiving utility for Linux.
- ls – list directory contents.
- make – a utility that will determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them.