How to Compile & Install TAR GZ & TAR BZ2 Files in Ubuntu Linux

Tim Brookes 29-12-2010

how to install tar gzUnlike Windows, installing software in Linux Getting Started With Linux and Ubuntu You're interested in switching to Linux... but where do you start? Is your PC compatible? Will your favorite apps work? Here's everything you need to know to get started with Linux. Read More has the potential to be slightly more complicated. Unless your chosen software is already in package form or resides in a repository Your Guide to Ubuntu Repositories and Package Management Read More and can be installed with a simple line of text, the chances are you’re going to need to compile and install from a .TAR.GZ or .TAR.BZ2 file.


This can be a nightmare, but if you stick to the rules it shouldn’t be. If you’ve got a pesky archive that needs installing, the following method will create a package, install said package and provide a nice clean way to remove the software afterwards via your package manager. Command lines at the ready, deep breath please…

Tarballs Of Steel

A .TAR.GZ/BZ2 file is a compressed tarball (the uncompressed extension being .TAR) which contains the raw source code for your chosen application. Installation requires these files to be compiled, processed and linked in a way that Ubuntu can then execute the program.

The tarball format was standardised in 1988 (and again in 2001) and continues to be widely used on both Linux and Windows for the distribution of software. Originally tarballs were designed to facilitate the backup of data The Best Free Backup Software for Your PC Read More onto tape devices, not that you’ll be doing that.

If you’ve not used the Linux command line before there’s no need to worry, the commands are straight-forward and cohesive.


Preparing Your System

You’ll need to install a package called build-essential for creating the package from source and checkinstall to add it to your package manager for easy removal. This can be done quickly via the console, simply open up Terminal (Applications, Accessories, Terminal) and type:

sudo apt-get install build-essential checkinstall

how to install tar gz

Allow time for these to download and install, and once done you may also want to install version management software for upgrades, though you can always do this later. In any case, these three will do the trick:

sudo apt-get install subversion git-core mercurial

Next you’ll want a common directory to use when building these packages. You can technically put this anywhere, as long as it is writeable. The official Ubuntu documentation recommends


so we’ll stick with that:

sudo chown $USER /usr/local/src

Then make sure it’s writeable:

sudo chmod u+rwx /usr/local/src

Finally we’ll also install apt-file, which is used to resolve any dependency issues you encounter:

sudo apt-get install apt-file

How to Compile & Install TAR GZ & TAR BZ2 Files in Ubuntu Linux apt file


You’ll probably get a pop-up telling you need to update apt-file, if not run the following command and let it finish:

sudo apt-file update

Once you’ve done this, you’ll never need to do it again as your system will be prepared for any tarballs you throw at it.

Extract & Configure

Assuming you’ve already downloaded a mysterious .TAR.GZ file you’re first going to need to move it to your designated build folder (I used


). You can do this with your normal file browser Nautilus Elementary Simplifies File Browsing on Linux Read More , and once done, open up a new Terminal.


How to Compile & Install TAR GZ & TAR BZ2 Files in Ubuntu Linux tarinsrc

Change to the build folder by typing:

cd /usr/local/src

Next extract the archive. For .TAR.GZ files type:

tar -xzvf <filename>.tar.gz

And for .TAR.BZ2 files type:

tar -xjvf <filename>.tar.bz2

How to Compile & Install TAR GZ & TAR BZ2 Files in Ubuntu Linux untarpmw

If all went well you’ll see a long list of extracted files, like in the screenshot above. Don’t close the Terminal yet, we’re not done.

It is at this point I urge you to navigate to the folder your archive just created (with your usual file browser) and open either README or INSTALL should the files exist. If your particular software requires a different method to the one I’m about to go into then this file will hold the key. You can save yourself a lot of hassle by doing this.

You may also be able to choose different install options depending on the software, and the INSTALL or README will stipulate what these are. The files may have no extension, but are plain text and should open in Gedit or any text editor you choose.

As a general rule, the following commands will install your software with the default installation method.

Your tarball will have been extracted to a folder with the same name as the file, so change to this folder with the cd command you used earlier, like so:

cd /usr/local/src/<extracted folder>

install tar gz

Replace <extracted folder> with the name of the folder the archive created. Next you’ll need to configure the source files by typing:


Note: If your software does not have a configure file, you might want to try skipping straight to the Build & Install section of this article, though consult your INSTALL or README documentation first.

If you receive an error message related to autoconf, then you’ll need to install it by typing:

sudo apt-get install autoconf

Then run



install tar gz

This command will verify whether you have all the installed packages required to use your software. You can use apt-file which you installed earlier to fill in the blanks.

If you do receive an error (something like

configure: error: Library requirements ... not met

) have a look for the file not found above the error message, then using apt-file search by typing:

apt-file search <filename>.<extension>

This will tell you which package the file you require is in, so you can download it using:

sudo apt-get install <package>

This won’t necessarily always happen, but it is very useful if you don’t have the required dependencies.

When you’re satisfied you’ve got the packages (if you needed any) run the


command again.

how to install a tar gz file ubuntu

If all went well you’ll see

config.status: creating Makefile

– congratulations, you’re very nearly there! Lots of people give up before they get to this point, but you’re better than that.

Build & Install

Into the same Terminal window type:


Sit back, grab a coffee and breathe for a second. Depending on the size of your install this can take a while.

how to install a tar gz file ubuntu

Now you can install the program with the following command:

sudo checkinstall

Follow the on-screen prompts, add a description for your software and hit Enter on this screen:

install tar gz

If everything went well you’ll see Installation Successful. Pat yourself on the back. You’ve done well.

how to install a tar gz file ubuntu

Your software should now be installed to


and you’ll be able to run it from there without any problems.

how to install tar gz

Did you make it all the way through? Isn’t it easier just waiting for a package or getting it from the repositories? Maybe you found it… easy? Let us know in the comments.

Related topics: File Compression, Ubuntu.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Amon
    April 16, 2018 at 10:43 pm

    I get to ./configure and that's it. It just says "No such file or directory"
    install auto conf, already at latest version
    so like it says skip to make and build
    "No targets specified and no makefile found"
    And these problems aren't addressed here.

  2. JohnS
    July 9, 2016 at 9:39 am

    Using Linux exclusively for almost 10 years, I don't think I've ever used 'tar' to extract stuff - with GUI apps like file-roller, ark, etc. it's completely unnecessary, yet it's almost always included in 'tutorials'! It's almost as if they are trying to make it seem more complicated than it is...

    Lots of people saying the process is more complicated than Windows - but how many have actually downloaded & compiled built WINDOWS packages? None I'd wager, simply 'cos the Windoze user is intentionally kept isolated from the nitty-gritty stuff like building their own packages - after all, that what software developers are for, or at least they would like to have you believe...

    One thing I would whole-heartedly agree with is to read the INSTALL and README files. Even though 95% of the time there is only about 5-6 things that need to be learned bt rote about building packages, any deviations from the norm will almost always be listed in these two files.

  3. keep_flying
    July 8, 2016 at 8:54 pm

    As with another above all went well until the ./configure command, at this point I get
    "bash: ./configure: No such file or directory"
    If I skip to the build/install stage as suggested and use the command "make" I get
    "make: *** No targets specified and no makefile found. Stop."
    Can you offer some advice please?

    • Karina
      September 14, 2016 at 7:33 pm

      I got exactly the same problem!! Did you ever get it sorted?

      • Miguel
        July 16, 2017 at 1:56 pm

        I got the same problem. Does anyone have any idea what to do when this happens? There is an executable that I can run when I unpack the tar, but the software is unstable and crashes continually.

        • sushikat
          June 13, 2018 at 12:36 am

          When you do the ./configure part, you have to be in the first level of whatever you're installing.

          For example, if I'm installing a tarball called thingy.gz, it will unpack to a folder called 'thingy'. You then have to 'cd thingy' to get to the top layer. ./configure should work from there.

  4. oiashofuh
    April 7, 2016 at 2:28 pm


  5. Anonymous
    July 11, 2015 at 5:30 pm

    I am using Ubuntu 14.04.
    I have downloaded the latest version of Pycharm for using Python programming language called pycharm-community-4.5.3.tar.gz
    from the website:
    The earlier Pycharm 5.4.2 is running fine in this computer but this new 4.5.3 has no .configue or install or readme.txt file.

    I extracted the file but it had no .configure file or install file or any readme files.
    I also copied the tar.gz file from Downloads to /usr/local/src
    and extracted the file there.
    when i type ./confiuge i got an error:
    ./configure: No such file or directory
    Also, i tried make command and it gave an error:
    make: *** No targets specified and no makefile found. Stop.

    I am wondering how to install this program.
    Any suggestions would be greatly appreciated!!

    • Sam
      November 11, 2016 at 10:22 am

      I just installed PyCharm on Ubuntu. All you have to do is copy the tar.gz to a folder where you want it to run (I chose /usr/local/src, but /usr/local may be a better choice) and extract it with with the given instructions. Then go into the bin directory within the extracted folder and run with ./
      Once the program is opened with a project, go to Tools -> Create Desktop Entry to make a shortcut that can be searched.

  6. Karthik K
    June 3, 2015 at 9:13 pm

    Thank you for the spoon feeding. Its a great tutorial for a Linux learner like me. Do you have any idea on this issue? When I go to most of the https websites getting this error, "The page cannot be displayed (500-100) There has been a system error and this page is not currently available." I get this issue in Firefox, Ubuntu web browser and Chrome. I'm on Ubuntu 12.04. But the same site is working in IE or any browser on Windows 7 computer. Any work around please.

  7. Tricia
    May 15, 2015 at 9:03 am

    Thanks alot Tim. This was very helpful and easy to follow. cheers

  8. agreatfuldude
    March 3, 2015 at 12:11 am

    I got everything to work, it created a new file in my bin (i'm trying to install a solitair game, babysteps, right?) but i dont really know what to do with the file..

    • Ultraportal(dot)eu
      April 28, 2015 at 10:21 pm

      Hi , bin file is like exe in windows, in terminal try:
      #sudo ./yourfolder/solitare.bin
      It should fire up ;)

  9. agreatfuldude
    March 3, 2015 at 12:08 am

    i had no idea how complicated linux is, i really opened up a can of worms lol... but if i found more guides like this, i shouldn't have any problems..


  10. Kevin
    February 18, 2015 at 8:13 pm

    Hi, guys. Please help. I'm getting an error when I enter the "make". Three files couldn't be found. System.Data, Mono.Data.Sqlite and System.Web. I've tried to apt-file search each of those files and installed a package containing those files but the same three error fail keeps coming back. I was trying to compile an installer for opencachemanager-1.0.15 on my Linux Mint 14. I had downloaded a tarball and was attempting a compile from the folder of the same name that I extracted.

    • Kevin
      February 19, 2015 at 11:16 am

      Thanks anyway. Figured it out.

  11. werxn
    March 25, 2011 at 9:18 am

    This was painfully overwhelming for my grandmother. Why does this process have to be so complicated? Is this something Linux is lacking in or just the way it's intentionally set up?

  12. S1234441
    January 29, 2011 at 3:08 am

    guest is a retard

  13. guest
    December 31, 2010 at 5:58 am

    can you tell me what theme and icons are these?

  14. Inno
    December 30, 2010 at 2:51 am

    tks, but this just gets me to the problem. With make install do you need to define a destination directory? what is the syntax? The app install file has:


    to build, and (as root)

    make install PREFIX=/usr/local

    to install, the default PREFIX is /usr. app can be installed inside a different destination directory (other than /) via

    make install PREFIX=/usr/local DESTDIR=my_destination_dir

    what does the correct syntax look like? tks

  15. Inno
    December 30, 2010 at 3:51 am

    tks, but this just gets me to the problem. With make install do you need to define a destination directory? what is the syntax? The app install file has:


    to build, and (as root)

    make install PREFIX=/usr/local

    to install, the default PREFIX is /usr. app can be installed inside a different destination directory (other than /) via

    make install PREFIX=/usr/local DESTDIR=my_destination_dir

    what does the correct syntax look like? tks