How to Install a Tar.gz File on Ubuntu Linux
Here’s how to install tar.gz files on modern Ubuntu Linux releases.
If you use Ubuntu Linux, you will sooner or later find yourself faced with the task of installing a tar.gz file. This article walks through the steps of installing tar.gz files on modern Ubuntu releases.
What Is a tar.gz File?
A file with the extension tar.gz is an archive file. That means it contains one or more files inside it, which are compressed into a single archive file. Tar.gz files are similar to ZIP files in this respect.
Importantly, not every tar.gz file that you encounter on Ubuntu contains an installable application. Tar.gz files can be used for a variety of other purposes, such as storing a collection of documents. Don’t assume, then, that just because you have a tar.gz, it’s software you can install.
That said, because tar.gz files offer programmers an easy way of packaging all of the code for an application inside a single file, they are frequently used to distribute software for Linux. That’s why, as an Ubuntu user, you may find yourself wanting to install an application that you downloaded as a tar.gz file.
It ’s worth noting, too, that applications are sometimes packaged into files with extensions that are similar to tar.gz, but not identical. Common examples include tar.bz2 and tar.xz files. These files work in almost the same way as tar.gz files; the main difference between them is the tool used to compress the data inside them.
Since tar.gz is probably the most popular archive file format on Ubuntu, we’ll focus on those files below. But the instructions here will generally apply to any type of tar.* file (in other words, any file whose extension is made up of “tar” followed some other letters).
Installing tar.gz Files on Ubuntu
Because the data inside a tar.gz file can take many different forms, there is no single way to install a tar.gz file on Ubuntu. Instead, there are various strategies you should consider. We’ll discuss each one below, starting with the easiest solution for installing a tar.gz file.
Use a Debian package instead.
The easiest way to install tar.gz files on Ubuntu is not to install them at all, but instead to install the application you want using a Debian package file. Debian packages, whose file names usually end in .deb, are another way of packaging applications for Ubuntu and similar operating systems.
It’s preferable to install an application using a Debian package instead of a tar.gz file, for several reasons:
With the Debian package, everything you need to install and run the application is built in. You don’t need to worry about compiling source code, which you typically have to do when dealing with tar.gz files. (See below for more on this.)
Debian packages are easier to install. Usually, you can install them with just a few clicks using graphical tools.
If you install a Debian package from a repository in the Ubuntu Software Center, Ubuntu will automatically update the application for you whenever a newer version becomes available.
So, before trying to install your tar.gz file, see if you can find a Debian package instead. Search the Ubuntu Software Center first. If the app isn’t available there, check the app’s official website to see if it offers a Debian package for download. If that fails, try googling “[app name] Debian package” to see if someone else has built a Debian package of the application for you. Once you’ve downloaded the Debian package, right-click on it and select “Open with Software Center” to install it through the Software Center. (You can also install it from the command line using the dpkg command, if you want to feel like a true geek.)
If you really can’t find a Debian package for your app, or you need a version of the app that is not available from a Debian package, read on for tips on installing from the tar.gz file.
Check the tar.gz for installation instructions.
Your next step is to look inside the tar.gz to see if it includes instructions on how to install the application. You can do this by opening the Archive Manager app in Ubuntu. (The app is also sometimes called File Roller, and you can run it from the command line by typing file-roller if you can’t find a graphical launcher.)
For example, here’s what you ’ll see if you download the tar.gz installation package for Tar (which just happens to be a program for creating and opening tar.gz files):
tar.gz ubuntu linux
You’ll notice it contains a file called INSTALL. If you open that file, it offers detailed installation instructions for the application. (If there is no file with a name like INSTALL, check for a README file instead.) Installing the application in this case is as easy as following the instructions.
The installation steps for tar.gz files can vary widely depending on what kind of code you’re dealing with. In most cases, though, you’ll need to perform two basic steps before you can follow any installation instructions:
Extract the tar.gz file to a folder on your computer. You can do this by clicking the Extract button in the upper-left corner of Archive Manager.
Install the build-essential package on Ubuntu. You can do this in a terminal with the command sudo apt-get install build-essential. This package contains software you’ll need to compile source code, which is usually (but not always) required to install a tar.gz file on Ubuntu.
Use Make to install the application.
You’ll sometimes find a tar.gz file that contains source code but no installation instructions. In that case, you can try running generic Make installation commands. Source code for Ubuntu is typically intended to be compiled and installed using a program called Make. Thus, there is a decent chance that whoever created the tar.gz file intended for it to be installed via Make, even if it came with no instructions.
To install via Make, first make sure you have extracted the tar.gz file and have installed the build-essential package, as explained above. Then, open a terminal and use the cd command to navigate to the folder where the extracted tar.gz data is stored. For example, if you extracted it to a folder on your desktop named “my app,” you would run:
cd /home//Desktop/my app
From here, type:
./configure
This command configures the source code so it can be compiled on your computer. You may be asked some questions about how you want to build the application, or you may not, depending on what the source code is designed to do.
Now, type:
make
This compiles the source code. It could take some time for this process to complete if you are dealing with a large application.
Finally, run:
make install
This command copies the code that you compiled into Ubuntu so that you can execute it.
Again, don’t expect this to work for every tar.gz file you may want to install. But in general, this is the process you can expect to follow.
If All Else Fails…
If you’ve tried everything above and still can’t get your tar.gz file to install, your best bet is to look for guidance online tailored to your application. Start with Google, and if you come up dry, consider asking for help in a forum site, like Ubuntu Forums.
Keep in mind, too, that installing applications from a tar.gz file on Ubuntu or any other operating system is not exactly a beginner’s task. It’s complicated, and is subject to so many variables that it can be a frustrating process even for experienced users.
Fortunately, the Ubuntu ecosystem is now so rich that having to install software from a tar.gz file is rare these days. Almost all applications that run on Ubuntu are available as Debian packages. But when you do encounter a tar.gz on Ubuntu, the guidance above--combined with a little luck--will provide what you need to install it.
About the Author
You May Also Like