116

Possible Duplicate:
How to install a .tar.gz (or .tar.bz2) file?

I am newbie to ubuntu. I would like someone to explain how to use sudo command to unzip & install .tar.gz file to me.

2

4 Answers 4

108

No need to use sudo to unpack the archive. Type this in a terminal:

tar -xzf archive.tar.gz

Or you can just double-click on the archive from Nautilus (the file manager) to see what's inside. No need for command line until now.

If this archive contains something to install in the system, then sudo would be useful at one point or another. Very often, such an archive contains software that must be compiled and then installed. Typically, what you then do is as follows:

tar -xzf archive-name.tar.gz
cd archive-name
./configure
make
sudo make install

As you see, only the step actually installing the program requires superuser rights; everything else happens just in your home directory, which you own. Please do not type blindly the instructions above; first, read any documents called "README" or "INSTALLATION" that you will find in the archive.

5
  • 2
    When I run into this situation it is usually not something that needs to be compiled. Basically I just need to unzip it, put it somewhere, and sometimes link the main executable to a directory that is in $PATH. I am wondering what the appropriate directories would be in Ubuntu.
    – Selah
    Mar 15, 2018 at 15:23
  • Is it normal to take more than 30 minutes to compile? I'm still waiting and have i7 with SSD on it... Dec 14, 2019 at 14:56
  • 2
    what if configure is not there? Sep 29, 2020 at 13:26
  • 1
    Hello again, old friend..
    – Bhaskar
    Dec 23, 2020 at 13:51
  • What ./configure does?
    – Dune
    Jun 14, 2021 at 8:15
18

Like January said if the file .tar.gz is owned by your user, you don't need sudo to extract the file.

To install some file *.tar.gz, you basically would do:

  1. Open a console, and go to the directory where the file is

  2. Type: tar -zxvf file.tar.gz

  3. Read the file INSTALL and/or README to know if you need some dependencies.

Most of the times you only need to:

  1. type ./configure

  2. make

  3. sudo make install

2
  • 2
    did not work for me Mar 17, 2018 at 18:51
  • @LEMAdane Can you provide more information on what didnt work?
    – LnxSlck
    Mar 24, 2018 at 11:29
6

Type these commands :

tar -zxvf file_name.tar.gz

This will extract the file_name.gz to a particular directory. cd folder/

This will change the directory to where you have extracted your tar.gz

./configure
make
sudo make install

These will install your application. For further information visit these links :

5

Your concept about sudo is wrong. sudo is the command to give root privilege to an action. For more details, type man sudo in terminal.

sudo apt-get install softwarename means you are giving root privileges to apt-get program to install software. apt-get (for more details type man apt-get in terminal) can't install software from source code. tar balls are usually source codes.

For installing software from tar ball, follow the instructions in the post:

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