How To Install Tarballs In Linux The Right Way

written by RichCat06 on July 20, 2023

You go to a website, and you download this file (it could be .tar.gz or .tar.bz2, but that's not important.) You don't know what to do with it, but when you extract it, you take a look at the contents of the file and think to yourself, "this looks an awful lot like the portable .zip of a program." Well, you aren't too far off in making that assumption. Today, I will be teaching you how to properly install this file in Linux, as there are virtually no guides showing you how to do this thanks to neckbeards trying to gatekeep Linux from the average Joe. Without further ado, let's get started.

Open your terminal, and type in this command (it will give you root access so you can actually install the program):

sudo bash

Then, copy the tarball to the /usr/lib folder with this command:

cp /home/username/Downloads/program-1.23.en-US.linux-amd64.tar.gz /usr/lib

Next, change into the /usr/lib directory:

cd /usr/lib

Now, with extracting the tarball, this will depend on what format it is.

If it's a tar.gz file, use this command:

tar -xvf program-1.23.en-US.linux-amd64.tar.gz

If it's a tar.bz2, use this command:

tar -xjvf program-1.23.en-US.linux-amd64.tar.bz2

Next, you're gonna need root to take ownership of the folder you just extracted. To do this, type this command:

chown -R root:root /usr/lib/program/

Now, we're gonna need to create a file in /usr/bin/ that tells the OS how to start the program. Type this command as the first part of this step:

nano /usr/bin/program

Next, type in this text into the file:

cd /usr/lib/program

./program

Now you can go ahead and save the file and exit the editor.

Next, you're gonna need to give the file you just created permission to run as a program. To do this, type this command:

chmod +x /usr/bin/program

Now, you're gonna wanna create the desktop icon that'll appear in your Applications menu. To start, run this command:

nano /usr/share/applications/program.desktop

Then, type the text below into the file:

[Desktop Entry]

Name=Program

Comment=Program Comment

Exec=program

Icon=/usr/lib/program/icons/program.xpm

Terminal=false

Type=Application

Categories=Application;Other;

Now, save the file, and close the editor.

All you have to do now is close the terminal and restart, or, if you don't wanna reboot your system, log out and log back in.