684

I have downloaded tar.gz files. But I don't know how to install it. How do I install this kind of file?

6
  • 22
    As mentioned in some of the answers below, try hard not to install packages via tarball as it will often bork managed packages and get you into in unresolvable state, and make you very sad. Installing via package manager is preferrable in 99.14159265% of cases.
    – Catskul
    Apr 15, 2015 at 14:49
  • 1
    There is a helpful video on YouTube which explains it: youtube.com/watch?v=njqib0fzE9c
    – Benny Code
    Jul 10, 2016 at 22:33
  • 1
    I tried this and it worked.
    – Kulasangar
    Oct 13, 2017 at 8:19
  • Try this blog.bluematador.com/posts/…
    – gpaoli
    Mar 14, 2018 at 11:37
  • is this the same for ubuntu 18 or is there a UI to do it too?
    – tgkprog
    Jan 20, 2019 at 5:12

14 Answers 14

377

The first thing you need to do is extract the files from inside the tar archive to a folder. Let's copy the files to your desktop. You can extract an archive by right-clicking the archive file's icon inside your file browser and pressing the appropriate entry in the context menu. Extracting the archive should create a new folder with a similar name. e.g. program-1.2.3. Now you need to open your terminal and navigate to that directory using the following command:

cd /home/yourusername/Desktop/program-1.2.3

Make sure you read a file called INSTALL, INSTALL.txt, README, or something similar if one was extracted. You can check if such a file exists from the terminal by using the ls command. The file can be opened and read with the command:

xdg-open INSTALL

Where INSTALL is the name of your file. This file will contain the right steps to follow to continue the installation process. Usually, the three "classical" steps are:

./configure
make
sudo make install

You may also need to install some dependencies if, for example, running configure prompted you with an error listing which dependencies you are missing.

You can also use checkinstall instead of make install.

Remember that your mileage may vary.

15
  • 42
    I would very much recommend using checkinstall, as that will make uninstalling the application much easier. Aug 5, 2010 at 10:10
  • 3
    Personally I like to put source in ~/src to keep my Desktop clutter free :)
    – invert
    Aug 5, 2010 at 11:35
  • 3
    ..of course assuming the tarball contains some kind of source code.
    – andol
    Aug 5, 2010 at 12:29
  • 1
    these are instructions for a specific case... a more common case I run into does not require compiling, the important information to know is where in my filesystem I should move it and how to make .desktop icon file
    – Selah
    Mar 28, 2015 at 17:50
  • 1
    Tarballs are used to distribute source code almost every time. If you have any specific example of unusual tarball, you may consider adding it as an answer and that would be a specific case. Mar 29, 2015 at 16:23
184

You cannot "install" a .tar.gz file or .tar.bz2 file. .tar.gz files are gzip-compressed tarballs, compressed archives like .zip files. .bz2 files are compressed with bzip2. You can extract .tar.gz files using:

tar xzf file.tar.gz

Similarly you can extract .tar.bz2 files with

tar xjf file.tar.bz2

If you would like to see the files being extracted during unpacking, add v:

tar xzvf file.tar.gz

Even if you have no Internet connection, you can still use Ubuntu's package management system, just download the .deb files from http://packages.ubuntu.com/. Do not forget to download dependencies too.

For an easier way to install packages offline, see the question How can I install software offline?.

3
  • Erm.....How exactly do you download a .deb file & dependencies without an internet connection...? Dec 7, 2016 at 19:23
  • 4
    @AlwaysLearning How can you post a comment here without an Internet connection...? Try the linked "How can I install software offline" link.
    – Lekensteyn
    Dec 7, 2016 at 23:36
  • 1
    Sometimes there is actually no need for an installation. One has only to copy/move the archived files to the right folder: First, find out where the current installation resides, e.g., via which <SoftwareName>. Then move the extracted contents of tar.gz archive to that folder to overwrite the contents.
    – AlQuemist
    Feb 26, 2018 at 11:45
81

How you compile a program from a source

  1. Open a console
  2. Use the command cd to navigate to the correct folder. If there is a README file with installation instructions, use that instead.
  3. Extract the files with one of the commands

    • If it's tar.gz use tar xvzf PACKAGENAME.tar.gz
    • if it's a tar.bz2 use tar xvjf PACKAGENAME.tar.bz2
  4. ./configure

  5. make
  6. sudo make install (or with checkinstall)

Download a package from the software sources or the software center.

If you install a package via the software sources and not downloading the package on your own, you will get new updates to that package and install them via the Update Manager.

You could just install MYPACKAGE by typing in a terminal:

sudo apt-get install MYPACKAGE

or by using the software center and searching for MYPACKAGE. But if it's not there go with the source.

6
  • 7
    Well, more generic instructions would be "download the file, unpack and look for install instructions either inside or on the website".
    – Sergey
    Nov 18, 2011 at 22:21
  • 1
    I've never got any instructions for installing from a source, I only get a folder with some install.sh or configure files. What sources do you download?
    – Alvar
    Nov 19, 2011 at 9:08
  • @sergey is it better now?
    – Alvar
    Nov 19, 2011 at 9:15
  • 4
    @Alvar: ./configure && make && sudo make install assumes that the package uses an autoconf style of configuring and compiling programs. You should search for the files INSTALL, README or similar. Also, make install won't work if the prefix is set to a privileged location (which is the default). Therefore, use sudo make install or install it into a directory in the home directory using ./configure --prefix=~/yourprogram. Then put ~/yourprogram/bin in your $PATH or make symlinks to it in ~/bin/.
    – Lekensteyn
    Nov 19, 2011 at 10:14
  • 1
    Notice that the part about k3b is because this answer was merged from another question (which, I presume, was about installing k3b from source). So if you're not trying to install k3b, don't follow that! Not saying that k3b is bad though =P
    – MiJyn
    Jun 27, 2013 at 2:01
37

This is only for .tar.* files which have the code pre-compiled but packed into a tar file.

Okay, this is a fairly challenging task for a beginner, but just follow my instructions, and it should be fine.

First off, download the .tar.* file, and save it. Don't open it. (In these examples, I'll be installing the Dropbox Beta build, because I was going to install it anyway, so I figured that I might as well document the installation.)

After you've downloaded your file, (assuming that you saved it to Downloads,) type the following:

cd Downloads
sudo cp dropbox-lnx.x86_64-1.5.36.tar.gz /opt/

NOTE: use the name of whatever file you downloaded. (e.g., for the Firefox Nightly 19.0a1 64-bit build, you would type sudo cp firefox-19.0a1.en-US.linux-x86_64.tar.bz2 /opt/)

Now, change to the /opt/ directory, extract the program, and remove the old file:

cd /opt/
sudo tar -xvf dropbox-lnx.x86_64-1.5.36.tar.gz
sudo rm -rf dropbox-lnx.x86_64-1.5.36.tar.gz

(again, use the name of the downloaded file. Don't forget the extension.)

Okay, check to see what the extracted folder is called:

ls -a

you'll get something like this:

james@james-OptiPlex-GX620:/opt$ ls -a
.  ..  .dropbox-dist
james@james-OptiPlex-GX620:/opt$

Okay, in our example, we installed Dropbox, and the only folder there is called .dropbox-dist. That's probably the folder we want, so plug that in to the next step (add a / to the end, since it's a folder.):

sudo chmod 777 .dropbox-dist/

Okay, it's now marked as executable, so it's time to create a symbolic link (this is what allows you to run it from the Terminal):

sudo ln -s /opt/.dropbox-dist/ /usr/bin/dropbox

NOTE: this is sudo ln -s /opt/{FOLDER_NAME}/ /usr/bin/{PROGRAM_NAME}!!! Be sure that {PROGRAM_NAME} is replaced with the simplified, lower-case version of the program's name (e.g., for Firefox Nightly, type firefox-nightly; for the uTorrent server, type utserver. Whatever you type here will be the command that you use whenever running the program from the Terminal. Think of /usr/bin/ as like the PATH variable on Windows systems.)

Okay, you're done. The program is now installed and runnable from the Terminal.
What's this? You say you want to run it from the launcher, AND you want it to have an icon? No problem!

This part is fairly simple:

gksu gedit /usr/share/applications/dropbox.desktop

NOTE: If you're installing OVER a previous installation, use ls -a /usr/share/applications and search for pre-existing .desktop file. Plug that file's name in instead.

Now, here's where you create the icon. Here's good template; edit it appropriately.

[Desktop Entry]
Version=1.0
Name=Firefox Nightly
Comment=Browse the World Wide Web
GenericName=Web Browser
Keywords=Internet;WWW;Browser;Web;Explorer
Exec=firefox-nightly
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/opt/firefox/icons/mozicon128.png
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
StartupNotify=true
Actions=NewWindow;

[Desktop Action NewWindow]
Name=Open a New Window
Exec=firefox-nightly -new-window
OnlyShowIn=Unity;

You may want to leave off the MimeType option completely. That could be very bad if you didn't.

Now, click "Save", close it out, and you're in business!

5
  • 2
    I think this isn't a good answer, because you don't differentiate between software that you have as binary and software in source code.
    – BuZZ-dEE
    Oct 14, 2012 at 23:14
  • 2
    Think you are getting the down votes because you are not explaining what to do with most source code packed file you download. Just because dropbox came on a nice binary ready to be extracted to /opt that does not mean that every application will be delivered that way, specially since dropbox is closed source. This does not explain how to pick up a source package, build it and install it as it is. Dec 26, 2012 at 0:17
  • What does "Okay, it's now marked as executable, so it's time to create a symbolic link (this is what allows you to run it from the Terminal)" mean?
    – user25656
    Jul 23, 2013 at 12:33
  • 2
    sudo ln -s /opt/{FOLDER_NAME}/ etc. shoud be sudo ln -s /opt/{FOLDER_NAME}/{program real name} ? etc.
    – Ferroao
    Dec 5, 2017 at 17:51
  • So does cp dropbox-lnx.x86_64-1.5.36.tar.gz /opt/ unpack the archive automatically?
    – Cadoiz
    Nov 15, 2021 at 17:33
22

First things first

It is generally not advised to download and install applications from the internet files. Most applications for Ubuntu are available through the "Ubuntu Software Center" on your system (for example, K3B Install K3B). Installing from the Software Center is much more secure, much easier, and will allow the app to get updates from Ubuntu.

That said, how to install tar packages

The best way is to download the tar.bz2 and tar.gz packages to your system first. Next is to rightclick on the file and select extract to decompress the files. Open the location of the folder you extracted and look for the Readme file and double click to open it and follow the instruction on how to install the particular package because, there could be different instruction available for the proper installation of the file which the normal routine might not be able to forestall without some errors.

17

First of all it is important to install the package build-essential, it contains all programs needed to compile on your own.

After reading the INSTALL file as stated above and fulfilling the prerequisites you can do the magic.

./configure && make && sudo make install
12

It is difficult to answer specifically, as each software may have a different build process, even if they are archived as a TAR/GZ

What I can say for most source codes that I know of is that you will first need to extract the tarball archive into a folder of your choice. Then most source codes rely on the AUTOCONF and MAKE programs, so you will need to use the following commands :

./configure
make

To build your binaries, and then :

make install

To install it in the system.

"./configure" uses the autoconf mechanism to retrieve information on your system, and prepare the build scripts in the source file in order to build the appropriate binaries compatible with your installation. "make" will invode the build itself, that will create the binaries out of the source code. "make install" will then copy the binaries, documentation, configuration file, etc. into the appropriate folders of your system so that the software is available to the users.

It is a very basic explanation, the real answer is : read the documentation provided with the source code... Only there you will know exactly how to build it.

8

You should always try to install software from repositories whether it's official, a PPA/any other unofficial repository. That way, you'll get all stable release, security and new feature updates while you install other system updates. Another advantage is that you don't need to worry about building, dependencies and harder uninstallation (since the application won't appear in synaptic) with tar files.

For example, you can install mysql by installing mysql-server package.

If you really want to use tar files, the common process is to run (make install may require sudo):

./configure
make
make install

Please note that some of the above commands may not be necessary, please refer to any readme files in the tar file or try to run ./configure --help

0
8

Files with the extension tar.bz2 are what is commonly known as a compressed tarball. Other examples are .tar.gz (more common) and .tgz.

You can extract this file with...

tar -xvjf file.tar.bz2

This will extract the files from the tarball into the directory you are currently in and should create a new directory there with in that the files from the tarball.

Short explanation on the options:

  • -x : extract
  • -v : verbose: show what is being extracted
  • -j : type of compression, in this case bzip2
  • -f : 'next comes the filename'

This is probably not enough though. Depending on what it is it could have a complete compiled setup and you need to cd into the new directory and start an executable. It could also contain the source to a program that you need to confire, make, make install. Generally (ie. I would assume) it should contain a readme that explains what to do next.

Warning:

Installing software like this will NOT install any dependencies and will complain if you try to install a tarball before you installed these dependencies. Use a website or the file itself to find out if there are dependencies and install those first. But always always always first try to find a .DEBian installation file or a link to a ppa so you can use ubuntu software center.


If you are trying to install the gimp plugins you skipped parts of the installation process mentioned in this link.

wget ftp://ftp.gtk.org/pub/babl/0.1/babl-0.1.10.tar.bz2
tar -xvf babl-0.1.10.tar.bz2
cd babl-0.1.10/
./configure
make
sudo make install

and you will also need gegl:

wget ftp://ftp.gimp.org/pub/gegl/0.2/gegl-0.2.0.tar.bz2
tar -xvf gegl-0.2.0.tar.bz2
cd gegl-0.2.0/
./configure
make
sudo make install

Before downloading the files with wget visit the website and see if it has newer versions. These instructions are from the 3rd of May 2012 so they could be old ;)

5
  • 1
    I ran tar -xvjf and then ./configure and I got an error message, see my edit in the original post.
    – Wut
    May 17, 2012 at 23:35
  • Yes. Also, I did that and got another error, please see my second edit in the original post.
    – Wut
    May 18, 2012 at 0:04
  • Could you rephrase that?
    – Wut
    May 18, 2012 at 0:10
  • you installed babl. the 1st time you got an error it ONLY complained about babl. so try to configure the 1st tarball (the one that complained about babl) it might work now.
    – Rinzwind
    May 18, 2012 at 0:14
  • Oh, I see now. Judging by the tutorial you linked to in your post, I'm presuming there's a lot more I need to do, though. This is all way over my head so I guess I'll just wait for a .deb. Thanks for your help, though!
    – Wut
    May 18, 2012 at 0:23
7

From the official website of Linux Mint

Installing from archives (.zip tar.gz, etc.):

These archives generally contain the source of the package. Each of them generally has a different approach to install. I will be discussing a common method which will supposedly work for all of them.

General requirements:

  1. flex

  2. bison or bison++

  3. python

As these archives contains the source, your system needs the required programming languages to compile and build the source. So the general requirement packages stated above may not be sufficient for you. In that case you have to install the required packages through one of the processes #1,#2,#3 (requires internet connection). You can know about the dependencies about your software in a readme file included in the archives.

Steps:

  1. open the archives with archive manager by double clicking it, then extract it.

  2. code:

cd path-to-the-extracted-folder

  1. inside the extracted folder look carefully....

a. If you find a file named configure then

./configure    
make
sudo make install

If the first code fails to execute then run this code before above codes:

chmod +x configure

b. If you find a file named install.sh then

Code:

chmod +x install.sh

./install.sh or sudo ./install.sh (if it needs root permission)

or you can double click it and select run in terminal or simply run.

N.B.: sometimes there is a file, something like your_software_name.sh is found instead of install.sh. For this case, you have to replace install.sh with the correct name in the previous codes.

c. If you find a file named install then

code:

chmod +x install

./install or sudo ./install (if it needs root permission)

or you can double click it and select run in terminal or simply run.

d. If you find a file named make (if there is no configure file) then

code:

make
sudo make install

e. If you still can't find the required files

then it may be in a special folder (generally in a folder named bin). Move to this folder with cd command with the appropriate path and then look again and follow the same process.

3

Before compilation of extracted tar.gz-, tar.bz2-, tar.xz-archives you should do the following:

  1. At first you should check existence of Ubuntu package for the application, which you are trying to compile.
    For example if you are trying to compile Empathy you should search package archive for it on packages.ubuntu.com for your release (or for all releases).
    The results for Empathy:

    Package empathy

    • trusty (14.04LTS) (gnome): GNOME multi-protocol chat and call client 3.8.6-0ubuntu9: amd64 arm64 armhf i386 powerpc ppc64el
    • trusty-updates (gnome): GNOME multi-protocol chat and call client 3.8.6-0ubuntu9.2: amd64 arm64 armhf i386 powerpc ppc64el
    • xenial (16.04LTS) (gnome): GNOME multi-protocol chat and call client [universe]
      3.12.11-0ubuntu3: amd64 arm64 armhf i386 powerpc ppc64el s390x
    • artful (gnome): GNOME multi-protocol chat and call client [universe]
      3.25.90+really3.12.14-0ubuntu1: amd64 arm64 armhf i386 ppc64el s390x
    • bionic (gnome): GNOME multi-protocol chat and call client [universe]
      3.25.90+really3.12.14-0ubuntu1: amd64 arm64 armhf i386 ppc64el s390x
  2. Then install build-essential package with

    sudo apt-get install build-essential
    
  3. As we know that packages have dependencies (both on execution and on compilation), so we need to install compile time dependencies (also known as build-dependencies). You should enable Source code repositories (deb-src) in Software & Updates (software-properties-gtk) and then run

    sudo apt-get build-dep empathy
    
  4. Then you can extract downloaded source archive and try to compile it in usual way

    wget http://ftp.gnome.org/mirror/gnome.org/sources/empathy/3.25/empathy-3.25.90.tar.xz
    tar -xf empathy-3.25.90.tar.xz
    ./configure
    make
    sudo make install # or better - checkinstall
    

    Note: in this example ./configure stage will fail on Ubuntu Xenial (16.04 LTS) because of the fact that library versions dependencies are not satisfied.
    In that case you have two options - use older pre-compiled packaged version from repository, try to find newer version in PPAs or upgrade whole Ubuntu to next release (preferably LTS).

3

Sometimes the package contains a runnable file with the same name of the software. You can just run that on the terminal.

$ ./Software-Name
2

Often programs that are offered as tar.gz files do not need to be compiled from source; they just need to be unzipped, stuck in the appropriate directory, and linked to an executable path. Here are some example commands I used today.

tar -xzf ~/Downloads/Newprogram.tar.gz
sudo mv Newprogram/ /usr/local/lib/
sudo ln -s /usr/local/lib/Newprogram/run.sh /usr/local/bin/newprogram.sh

The directories I used were informed by this post: Where to install programs?

0

In this answer I am going to install one sample package ie. vlc for your reference but, before we go further I would like to give some information.

If you have used Windows you might come in contact with WinRAR,7-Zip, etc. and for Android RAR, Zarchiver, etc.

tar (TapeArchiver)is one kind of compression software. It makes an archive of files and folders but not compress them.

As archiver softwares have various mode such as

  • gz best speed with regular compression.
  • bz somewhere mid between regular compression and medium speed.
  • xz is better compression but poor speed.

Now come to the installation part!

first you must have tarball

  1. Lets download it wget http://get.videolan.org/vlc/3.0.8/vlc-3.0.8.tar.xz -c

here -c is for continue download (for your reference) 2. Extract package tar -xvf vlc-3.0.8.tar.xz

here x is extract, v for verbose, f for Regular file 3. Install package go to extracted directory cd vlc-3.0.8

./configure

Here is one issue is that you need to configure your linux pc for make sure that its dependency will get resolved so that you need to install some dependencies as follows

sudo apt-get install git build-essential 
sudo apt-get install pkg-config libtool automake 
sudo apt-get install autopoint gettext
sudo apt-get install libxcb-shm0-dev libxcb-xv0-dev 
sudo apt-get install libxcb-keysyms1-dev libxcb-randr0-dev 
sudo apt-get install libxcb-composite0-dev
sudo apt-get --no-install-recommends build-dep vlc

make

make install

if these commands run successfully, your vlc will be installed.

then run it by:

./vlc

Thanks..

1
  • 1
    As Petri Hintukainen claims one needs to install libblrray-master with a fix before libbluray 1.3.2 is released (see code.videolan.org/videolan/libbluray/-/issues/38), it would be good to see how to install VLC in Ubuntu where it does not complain when default-jre is installed (in Ubuntu 22.04.1 LTS)
    – Aendie
    Oct 16, 2022 at 17:11

You must log in to answer this question.

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