Understanding Linux Application Installation beyond Copy and Paste.
A guide to understanding common terminal operations that occur during the installation of a Linux application.
Linux is an open-source operating system built on top of UNIX by Linus Torvalds. It is widely used as the primary operating system for different types of shared servers including web servers, database servers, and email servers. Linux prides itself in providing record level security from malicious attacks.
Understandably, the operations performed on Linux as an operating system are directly influenced by the open-source concepts associated with it. One of these operations is the installation of software on Linux. Software installation on Linux can be done in several ways depending on the mode of distribution of the software by the developer and the user's preference. Some installation procedures require real-time retrieval of packages with third-party tools like wget
and cURL(an acronym for client URL), while others are available on the Linux distribution's package manager. What differences exist between these installations? Where is the software stored? Can you build yours?
In this article, you will learn about the common terminologies used during the installation of Linux applications, the installation media for Linux applications, and how to interpret commands for installing Linux applications.
Common Terminologies in Linux Installations.
Sudo.
Sudo is a ubiquitous command in every Linux distribution. The
sudo
command in any Linux environment is used to initiate superuser(or root user) privileges. This means, the computer - at the point of executing an instruction with thesudo
command - dispenses root user privileges to you at the cost of providing your password details for authentication.Repositories.
Linux uses repositories to host software packages. These repositories act as warehouses for housing installable software packages for a Linux distribution. Technically, you can regard them as a public hosting service from which a Linux user can pull a software for download locally.
Package Managers.
Package managers are the tools used to interact with the repositories provided by the different Linux distributions(or distros for short). These package managers handle the installation, configuration, upgrade and removal of the software provided by the repositories on your computer. Debian and Ubuntu use
apt
, Fedora usesdnf
, FreeBSD usespkg_add
, and OpenSUSE useszypper
. As you would find out in the later sections of this article, you can interact with these repositories with a series of commands for delegating instructions to your package manager.Transfer Utility Tools.
Transfer utility tools are used to interact with web servers via the command line. Examples of these tools are
wget
andcURL
; althoughcURL
offers more capabilities in terms of GUI extension and support for more network protocols compared towget
. Regardless of the context,wget
can always get the job of retrieving files from a remote server for use on your computer. These files, in our case, are the software distributed by developers for download.
In the following section, you would learn about the difference between installation from repositories and software installation without repositories.
Installation Media.
From Repositories.
Linux distributions, as stated previously, provide repositories for downloading software applications. These repositories are regarded as the recommended place to look for software you intend to install unless you are sure you won't find them there. The main reason for this recommendation is because of the simplicity the repositories provide.
The installation of software from a repository is initiated by an instruction to your computer's package manager whose underground action is to search for the proper name of the application you want to install. Think of the repository as a box containing different objects - balls, cups, books, etc. Upon request, the package manager initiates a search for the software name you specified and retrieves the software with a matching name(usually the official name) for installation. Sometimes, the name you specify might not be the official name of the software, in cases like these, the package manager handles the correction for you.
Here's a command to install snapd(a GUI software installer for Ubuntu) on Ubuntu.
>$ sudo apt install snapd
Alternatively, you can search for the software before installation to see the list of software matching the specified name.
>$ sudo apt search snapd
How about Installing Spotify on Fedora?
>$ sudo dnf install lpf-spotify-client
The same goes for every other Linux distribution out there, the package managers are the only different thing.
Additionally, you can add an extra repository for your package manager to look to if need be. By default, your Linux OS looks to its official repositories provided by the distribution. However, you can choose to install software from third-party repositories. This process requires you to install the repository like software. To do this, Fedora allows you to
add a repository with the dnf config-manager
command while Ubuntu requires you to install the add-apt-repository
script embedded in the software-properties-common
package. A more delicate approach is to edit the configuration file for your package manager.
Outside Repositories.
a. Linux Packages
Can you build your own Linux package? Absolutely! Some developers build Linux
software and distribute them in one of the supported packaging formats. Examples of
these packaging formats include .deb
for APT users(e.g Debian and Ubuntu) and
.rpm
for RPM users. This software can be downloaded from the internet to your
computer and installed in two ways.
The first method to install a downloaded Linux package is to double-click the file. A GUI installer will pop up to guide you through the installation process. Alternatively, you can initiate the installation from the terminal with your package manager.
Here's an example of installing a downloaded Linux package with Apt:
>$ sudo apt install <PATH-TO-FILE>/<FILE>.deb
The same goes for the majority of Linux distributions available, The only change needed is to the name of the distribution's package manager name.
b. Generic Install Scripts.
An alternative way of
distributing Linux packages is
by releasing them in one of the
generic formats available. The popular formats are the .sh
and .run
formats which
are usually executables. These scripts, like software in repositories, are sitting in a remote server and require you to fetch them to your computer. This is where transfer
utility tools like wget
and cURL come to play.
To install wget
, run the following command.
>$ sudo apt install wget
on Fedora:
>$ sudo dnf install wget
After the installation,
verify that wget
is installed with:
sudo dpkg -l | grep wget
To use wget
to download an installation script, run the following command.
>$ wget <INSTALL-SCRIPT-URL>/script.sh
The same step goes for installing cURL on your computer. However, cURL requires an additional flag to specify that you want to initiate a download operation.
>$ curl -o <INSTALL-SCRIPT-URL>/script.sh
With the installation script downloaded, you can run the application with sh
- a command language interpreter
used to execute instructions read from a command line string.
>$ sh .\xyz-file.sh
c. Application Directory.
This method is not exactly a standard for distributing software in the Linux ecosystem. However, some developers might choose to compress their software into a folder containing an executable and put it up for download. Using these types of software requires extracting the compressed file(usually a TAR(.tar.gz) file) and double-clicking the executable. This approach requires you to go to the download folder every time you need to run the application.
An alternative approach is to create a launcher file for the software. This involves navigating through a couple of Linux standard sub-directories which is beyond the scope of this article.
What Have You Learnt So Far?
Now that you've learnt how software installation works on Linux computers, and the different methods you can follow, you don't have to just copy and paste any more. You can take some time to interpret commands when following installation guides.
If you're interested in learning more about Linux, visit this link.
Don't forget to look into the geeky part of installing from the application directory :)
Till next time ๐จ