DEV Community

Arbitrary
Arbitrary

Posted on • Updated on

How to install tarball (.tar) files in linux

Does it happen to you that you that whenever you want to install a piece of software you're give either a .deb file or a .tar file. Installing .deb files is easy, it's just like how you do in windows, but .tar files are a pain specially for beginners.
In this simple tutorial we'll learn how to download and install .tar file. I'll use Ubuntu but it should work in most Linux distros. I'll install *waterfox web browser * but the process is similar for all the tarball (.tar) installation files.

tldr;

  1. download the tar file
  2. extract it to some location
  3. create a desktop entry for running the application

Detailed method

Step 1 :download the .tar file and then move it to the directory where you want to install it.

After downloading the file open the terminal in current directory to move the file to /opt directory using the following command.
you can change the filename and target directory accordingly.

sudo mv  waterfox-G4.0.5.en-US.linux-x86_64.tar.bz2 /opt
Enter fullscreen mode Exit fullscreen mode

Step 2: Extract the .tar file

first goto the directory where you moved the .tar file.

cd /opt/
Enter fullscreen mode Exit fullscreen mode

To extract the .tar file present in the current directory to use the following command

sudo tar xjf waterfox-G4.0.5.en-US.linux-x86_64.tar.bz2
Enter fullscreen mode Exit fullscreen mode

you can replace the .tar filename i.e. waterfox-G4.0.5.en-US.linux-x86_64.tar.bz2 as per your filename.

Step 3: Create desktop entry with appropriate permissions

make yourself owner of the extracted repository

sudo chown -R $USER /opt/waterfox
Enter fullscreen mode Exit fullscreen mode

Create a desktop entry so that you don't need to come to this directory to launch the application.
run the following command

gedit ~/.local/share/applications/waterfox.desktop
Enter fullscreen mode Exit fullscreen mode

it'll open gedit text editor where you need to insert the specifications of the desktop entry.
paste the following in the editor and save.

[Desktop Entry]
Name=Waterfox
Exec=/opt/waterfox/waterfox %u
Terminal=false
Icon=/opt/waterfox/browser/chrome/icons/default/default128.png
Type=Application
Categories=Application;Network;X-Developer;
Enter fullscreen mode Exit fullscreen mode

Again, change the various parameters and paths according to your setup.
The path can be directly under the first directory or inside bin directory, make sure you specify correct path.

Desktop entry has many parameters but only a few are required but you should add at least these. You can read more at Desktop Entry Standard

Finally you need to make your desktop entry executable using the following command.

chmod +x ~/.local/share/applications/waterfox.desktop
Enter fullscreen mode Exit fullscreen mode

you can change the name of desktop entry accordingly.

finally you can remove the .tar file using the following command

sudo rm -rf waterfox*.tar.bz2
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
sso profile image
Sall

Nice. Simple, but really useful. I always struggle to write descriptions like this in my projects :)

Collapse
 
arbitrary profile image
Arbitrary

If you like the post, don't forget to save it for future reference. Also share it with your dev groups. Thanks :)