Quick Tip: How to Install .deb and .tar Files in Linux

Share this article

Installing .deb and .tar Files in Linux
Installing .deb and .tar Files in Linux

In this quick tutorial, I explain how to install programs in Linux using terminal commands. This particular tutorial uses Linux Mint 18 (Cinnamon 64-bit), but the commands provided below are universal to other versions of Linux, such as Ubuntu. For those of you who are new to Linux, chances are you’ll be familiar with the in-built Software Manager:

In-built Linux software manager

In a nutshell, the Software Manager allows for easier installation of a variety of programs by simply searching for the program available, and then installing it from the manager. For instance, if a user wanted to install GIMP through the Software Manager, it would simply be a matter of locating the program and installing:

Installing GIMP

However, installations in Linux can regularly get more complicated than this, in that it’s often necessary to install programs directly from the source code. Here, I explain how to install two particular types of extensions that often give newbies to Linux quite a headache. (It certainly did for me when I was starting out!)

We’re going to look at the methods to install both Debian (deb) and Tarball (tar.gz) files through the terminal, and the two respective examples that will be used in this tutorial are Dropbox and VeraCrypt. The usual disclaimers apply: these two programs are only used for illustration purposes, and I’m not endorsing or promoting any particular products in this article.

1. Installing Dropbox through deb file

Installing deb files comes with varying degrees of difficulty. In other words, some programs that consist of deb files allow for direct installation, while those that contain many separate deb files typically must be installed through the terminal. Let’s look at the Dropbox example in installing the deb file.

Firstly, we’re selecting the Ubuntu 64-bit version (or the appropriate one for your system):

Choosing the Dropbox Ubuntu 64-bit version

Next, we’re prompted to install the package directly:

The Dropbox installer

While this particular deb file was easy enough to install, there are situations where we have to install the deb file directly from the terminal. For instance, instead of installing directly, the program could have prompted us to extract deb files to a particular location and then install from there.

Using Dropbox as an example, suppose that we were hypothetically prompted to extract files and then install. For illustration purposes, let’s call this folder Dropbox_deb, which is stored in our Downloads folder. Under this scenario, we would:

a. Set our directory to the Dropbox_deb folder in Downloads:

cd ~/Desktop/Dropbox_deb

b. Install the .deb files using the following command:

sudo dpkg -i *.deb

2. Installing VeraCrypt through tar file

In some instances, a user has to install through a tar file, which is a standard source download in Linux. Here, we install VeraCrypt through a tar.bz2 file (highlighted in yellow text in the image below):

installing VeraCrypt through a tar.bz2 file

Once the download is complete, we’re then prompted to extract shell (sh) files, which we’ll extract to the desktop in this example:

extracting shell files

Once we’ve extracted the sh files, it’s then a matter of executing them using the appropriate terminal commands. We see that we have four separate sh files, we are going to execute the veracrypt-1.18-setup-console-x64 file. Note that this one does not have the .sh extension at the end: if it had, then we would need to add .sh at the end of the file in the terminal.

We open up the terminal, setting the directory to Desktop (cd ~/Desktop), and run the commands as follows:

chmod +x veracrypt-1.18-setup-console-x64
sh ./veracrypt-1.18-setup-console-x64

Once we’ve done this, we see that the program prompts us to conduct a full installation inside the terminal:

full installation terminal prompt

Note that, in order to uninstall a program through the terminal, it’s done through the sudo apt-get remove command. For example, if a user wishes to uninstall Dropbox, it’s done through entering this command:

sudo apt-get remove dropbox

If you’re new to Linux, it’s important to take some time to familiarize yourself with the new OS, and nowhere is this more true than when it comes to installing programs, as many of them are not automatically included with the Software Manager. Here, we’ve covered two of the most common file types that are typically installed on Linux, and the above commands are key ones to keep in mind when it comes to installing new programs on this platform.

Frequently Asked Questions (FAQs) about Installing .deb and .tar Files in Linux

What are the main differences between .deb and .tar files?

.deb and .tar files are both types of compressed files used in Linux, but they serve different purposes. .deb files are Debian packages, which are used to install software in Debian-based Linux distributions like Ubuntu. They contain compiled binaries along with metadata like the software’s name, version, and dependencies. On the other hand, .tar files are Tape Archive files. They are a type of archive file that can contain any number of files and directories. They are often used to distribute source code for software, which can then be compiled and installed on any Linux distribution.

How can I install a .deb file in Linux?

To install a .deb file in Linux, you can use the dpkg command. First, navigate to the directory containing the .deb file using the cd command. Then, use the following command to install it: sudo dpkg -i filename.deb. Replace “filename.deb” with the name of your .deb file. You may need to enter your password for the sudo command.

How can I install a .tar file in Linux?

Installing a .tar file in Linux involves extracting the archive and then compiling and installing the software. First, navigate to the directory containing the .tar file and extract it using the following command: tar -xvf filename.tar. Then, navigate into the extracted directory and compile the software using the ./configure, make, and sudo make install commands.

What should I do if I encounter dependency issues when installing a .deb file?

If you encounter dependency issues when installing a .deb file, you can use the apt-get command to resolve them. After attempting to install the .deb file with dpkg, use the following command to install any missing dependencies: sudo apt-get install -f.

Can I install .deb files in non-Debian-based Linux distributions?

While .deb files are designed for Debian-based distributions, it is possible to install them in other distributions using tools like alien, which can convert .deb files into formats compatible with other distributions. However, this is generally not recommended as it can lead to compatibility issues.

Can I install .tar files in any Linux distribution?

Yes, .tar files can be installed in any Linux distribution. However, the process is more complex than installing .deb files and requires compiling the software from source.

How can I remove software installed from a .deb file?

To remove software installed from a .deb file, you can use the dpkg command with the -r option, like so: sudo dpkg -r packagename. Replace “packagename” with the name of the package you want to remove.

How can I remove software installed from a .tar file?

Removing software installed from a .tar file can be more complex, as it depends on how the software was installed. If the software was installed using make install, you can try using make uninstall within the software’s directory. However, this will only work if the Makefile provided by the software includes an uninstall rule.

Can I install .deb or .tar files without using the command line?

Yes, many Linux distributions provide graphical tools for installing .deb files. For example, in Ubuntu, you can double-click a .deb file to open it in the Software Center and install it from there. However, installing .tar files generally requires using the command line.

What are the risks of installing .deb or .tar files from untrusted sources?

Installing .deb or .tar files from untrusted sources can pose a security risk, as they can contain malicious code. Always ensure that you trust the source of the file and consider checking the file’s checksum to verify its integrity.

Michael GroganMichael Grogan
View Author

Michael Grogan is a data science consultant, with a profound passion for statistics and programming. He regularly utilizes programming languages such as Python, R and SQL to analyze a wide range of datasets, and also explores aspects of web development in designing interactive web apps for data science analytics. Find him at michaeljgrogan.com.

deb fileslinuxRalphMtar filesUbuntu
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week