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 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:
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):
Next, we’re prompted to install the package directly:
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:
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):
Once the download is complete, we’re then prompted to extract shell (sh) files, which we’ll extract to the desktop in this example:
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
Once we’ve done this, we see that the program prompts us to conduct a full installation inside the terminal:
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.
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.
Jump Start Git, 2nd Edition
Visual Studio Code: End-to-End Editing and Debugging Tools for Web Developers
Form Design Patterns