I would like to know how to install .tar.bz and .tar.bz2 packages on Debian. Could anyone help me understand how to achieve that?

  • 2
    Those are archives. You need to unpack them and see for instructions inside. Usually it's ./configure, make, make install, but I'm sure someone will provide better answer to you, with links where you can learn this very basic things before you actually try to build anything
    – zetah
    Commented Apr 30, 2012 at 14:57
  • 3
    Depending on what you want to install, you need also to install the build-essential package and -dev packages of the libraries which are used by the software. Take care that you install to the prefix /usr/local/ (which is normally the default), otherwise you may corrupt your system. For a beginner, I suggest you strongly to restrict yourself to the available packages from Debian. The next step would be to search for already packaged software (.deb packages) and install them then by hand dpkg -i ./path/to/package.deb. Using .tar.{gz,bz2} packages, is the last and most difficult option.
    – jofel
    Commented Apr 30, 2012 at 16:18
  • @jofel I agree with you, but some programs are not available in a .deb package and you can only install it from the source code (e.g. Firefox).
    – Zignd
    Commented Oct 30, 2012 at 10:21
  • 1
    Firefox is most definitely available in the repositories and rarely needs to be built from source. Commented Oct 30, 2012 at 13:03
  • 1
    If you want to install from sources by hand, the most difficult thing is often installing the right dependencies. If README or INSTALL does not list them, you can need to run the ./configure script by hand (for autoconf based build systems). If it fails with "checking for xyz: No", "xyz not found" or similar, install the package libxyz-dev (on Debian based systems) and try again. If the package does not exists, you need either to find the correct package or to install the needed library by hand first. Sometimes you have to select a specific library version.
    – jofel
    Commented Nov 2, 2012 at 10:09

5 Answers 5


Firstly, according to the File System Hierarchy Standards, the location of this installed package should be /opt if it is a binary install and /usr/local if it's a from source install.

Pure binaries

These are ready to use binaries. Normally they just need to be extracted to be installed. A binary package is going to be easy:

  • sudo tar --directory=/opt -xvf <file>.tar.[bz2|gz]
  • add the directory to your path: export PATH=$PATH:/opt/[package_name]/bin

and you are done.

From sources

A source package is going to be more troublesome (by far) and through they can roughly be processed with the method below, each package is different:

  • download the package to /usr/local/src
  • tar xf <file>.tar.[bz2|gz]
  • cd <package name>
  • read the README file (this almost certainly exists).
  • most Open Source projects use autoconf/automake, the instructions should be in the README. Probably this step will go: ./configure && make && make install (run the commands separately for sanity if something goes wrong though).

If there's any problems in the install then you'll have to ask specific questions. You might have problems of incorrect versions of libraries or missing dependencies. There's a reason that Debian packages everything up for you. And there is a reason Debian stable runs old packages - finding all the corner cases of installing packages on more than a dozen different architectures and countless different hardware/systems configurations is difficult. When you install something on your own you might run into one of these problems!

  • 3
    I made the tar command easier! You don't need to cd /opt. Instead cd to where the tarball is and use the tar -C or --directory option.
    – Jess
    Commented Mar 18, 2013 at 15:20

Unpack the files and then, in the directory that was created, look for a README or INSTALL file which will tell you what you need to know in order to install a package (e.g. dependencies, configuration options, commands to run etc...).

Usually it boils down to ./configure, make then make install.

  • 3
    Note that the build will most likely fail in configure. Why? Because the source you've downloaded probably has build time dependencies you don't have installed. On Debian/Ubuntu, if the package also is available with apt, you can install these with: sudo apt-get build-dep package-name
    – anonfunc
    Commented Nov 1, 2012 at 18:53

The standard way of doing this is:

  1. tar zxvf file.tar.gz or tar xvjpf file.tar.bz2
  2. run ./configure (./configure --help usually gives customization options)
  3. run make
  4. run make install

There is usually a README or INSTALL file that gives instructions as well.


Generally speaking, when you install tar.gz/tgz/tar/bz2 (remember, these are just compressed package files) you would need to break open the tar file (tar xvfz/tar xvfj) and then cd to the directory and run ./configure.

On some systems, you either take the defaults (/usr/local/{lib,bin,etc...} for example) as the default install location, or you might like to use /opt/local/{lib,bin,etc}.

So you would do ./configure --prefix=/usr/local and then make, make install.

It us up to you where you want to install your packages. Remember that where ever you decide to do it, you might want to add the path to your PATH shell variable so you can easily run those packages. (often export PATH=$PATH:/opt/local/bin:/usr/local/bin).


Let me illustrate this with an example, say you wish to install a package abc. The dependencies of the package abc may be identified by reading its documentation. You should resolve the dependencies(required libraries etc) prior to installation for a smooth experience.

Before a gcc 4.7.2 build the g++, m4, gawk, gcc-multilib, gmp, mpfr, and mpc must be built.

Then comes the building from source part for which the first step is always extraction. This can be done by using the tar command or by the simple GUI way. Once you have the extracted files in a folder you must browse to that folder using the cd command, for example if the contents are in Downloads then:

$cd Downloads/abc

Now you need to run ./configure. Specify the installation directory by using the --prefix= option with configure.

Firstly, according to the File System Hierarchy Standards, the location of this installed package should be /opt if it is a binary install and /usr/local if it's a from source install.

so if you are installing to the /usr/abc directory you will supply the option --prefix=/usr/abc with the ./configure instruction.

$./configure --prefix=/usr/abc

--prefix= is not the only thing you might want to specify though, you might want to supply other information for a successful compilation like the type of your system with --build=x86_64-linux-gnu for 64 bit, and --build=i386-linux-gnu for a 32 bit system. It is wise to read the README in the extracted files as it may carry the information about which options to specify with the ./configure command.

After the ./configure run the make command, and subsequently the make install. Post installation you should specify the library path, shell/environment variables using the export command.

export PATH=/usr/abc/bin:$PATH

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .