In this tutorial, you will understand every details about software installation in Linux. You will learn the following:
Package manager
Repository
Dependencies, etc.
UNDERSTANDING THE SUBJECT MATTER
Software installation in Linux is quite different from software installation in windows.
In windows, most times, you will have to download an executable file (.exe) and specify an installation path to install a software.
However, software installation in Linux requires using a software repository most of the time, and a package manager.
A package manager is a software program that is used to manage software in Linux systems. It can download, update, search and delete packages as it deems necessary on the system.
Before I continue, I will like to differentiate a software from a package.
To better explain this, I will be using the windows operating system as a comparison.
A package is like the .exe or a complete software folder in windows that contains all the programs/configuration files necessary to install a software.
Also in Linux, a package contains all the necessary binaries/code/ programs/configuration file necessary to install a software. More importantly, a package in Linux contains information about dependencies.
In windows for example, if you want to install Microsoft office 2016 which is a software, you will open the office 2016 folder that contains another folder and files (these folders and files are all the packages embedded in the software), you will then scroll to the setup file to run the program for installation.
Similarly in Linux, a package contains all the necessary files embedded in the software to install the software.
In windows, most times, you say things like, can you please install the sql software? Similarly, in Linux, you also say, can you please install the sql software? or something like, can you please install/get the sql package?
Hence, to a large extent, one can technically say that a package is also a software, somewhat.
Every packages/software have their format. Package format for Red Hat Enterprise Linux or CentOS is “.rpm” , for archived source code, the package format is “.tgz”, which is similar to “.zip” in windows or “.sit” in mac, while the package format for a Debian and Ubuntu system is “.deb”.
Continuing with what a package manager is, as the name implies, “PACKAGE MANAGER“, it manages packages by using an automation process of automatically downloading dependencies for a software, it also updates, queries and deletes dependencies where it deems necessary.
Basically, a package manager is tool used to manage software.
We used the word dependencies when trying to differentiate between a software and a package and now in package manager explanation.
What are dependencies?
Dependencies are other programs that a software depends on to run or function.
One thing one must know about Linux is that Some dependencies may depend on some other dependencies and some other dependencies may also depend on some other dependencies thereby making installation complex.
Before the existence of a package manager, installation in Linux has been a hell and frustrating. As a matter of fact, the complexity of dependencies has discouraged a lot of Linux users in those days from using Linux.
Thank God for package manager, the advent of package manager has solved this complex problem by automating the download of a package where it automatically downloads and update dependencies for a package to be installed.
Every package comes with a metadata which the package manager uses to automate the download and update of a dependency.
A repository or rather, a software repository is a central server where most software/packages are stored.
A repository can be compared to google play store as an example. When android users needs to install a software, they go to the play store to download and install the software. Same as Apple store for Mac users.
As mentioned before, software installation in windows is different from software installation in Linux. In Linux, the package manager most times does the installation by getting the packages to be installed from a repository.
Every Linux distribution have their default official repositories and they are available online.
Having understood what a package manager and a software repository is, the next question would be how the package manager goes into a repository to pull packages along side its dependencies for installation.
One thing you must also know is that a repository can’t be hosted on a Linux system.
How is it even possible for a Linux system to host a repository that contains thousands of software? What drive size on your Linux machine will you have to provision? It will be ridiculous!!!
Hence why every Linux distribution have a repository configuration file added to a package manager which is a directive of the official repository online.
For Red Hat Enterprise Linux, the repository configuration file for yum package manager is in “/etc/yum.repos.d” and must have a “.repo” extension for it to be able to point to the online repository.
Furthermore, some packages that you may want to install may not be in your Linux distribution’s repository. In this case, you will need to download the software from a site and install it on your Linux system, or add a third party repository to your package manager,
The repository could be from another distribution or an entirely community repository. Whichever, be very sure of the third party repository that you want to add to your package manager so you won’t be a victim of viruses and malware attacks.
An example of adding an extra repository to a package manager is one of the personal experiences I had as a Linux Engineer where I had to provide a GUI environment on a Red Hat Enterprise Linux server hosted on Azure cloud for a customer.
Moving forward, It is also possible to configure a local repository of your own instead of using any online repository or the one provided by your Linux distribution.
This often happens if you don’t want the server to be internet facing or do not have an active subscription with your distribution
There are different types of package manager for the different distribution of Linux and each type works with it’s format or file type.
For example, the package manager for Red Hat Enterprise Linux, centOS and their likes is yum while the package manager for Debian system, Ubuntu and their likes is apt.
Furthermore, the package manager for Arch Linux is pacman while the package manager for openSUSE is zypper .
Software installation in Linux requires using a Linux distribution’s package manager.
In Red Hat Enterprise Linux 8, installation of software is done by the dnf package manager. The dnf package manager known as yum version 4 (yum.4) is a newer version of the yum package manager, yum version 3 (yum).
Installing with yum on RHEL 8 and centOS 8 has a way of ensuring that the installation is done using the dnf package manager (yum.4). dnf has better dependency resolution and swift API integration among other benefits over yum.
Prior to Red Hat Enterprise Linux using yum as a package manager, the rpm (Red Hat package manager) was formerly used and still used today, but it doesn’t do an automated managing or downloads like pulling of dependencies as yum. rpm only installs software with rpm format.
rpm is a package file type (i.e. a package format) as well as a package manager (a tool used to manage packages)
Similarly, Debian system, ubuntu and their likes formerly used Debian package manager(dpkg). dpkg has it’s own limitations just as rpm too.
As Debian evolves, the advanced package tool manager(apt) was developed and used. The apt manager manages the “.deb” file format type just as yum manages the “.rpm” file format type.
. Having explained what yum and rpm is, one would agree that one of the difference between yum and rpm is that yum is a package manager while rpm is also a package manager as well as a package file format with an extension of “.rpm”
. yum is an easier package manager tool that resolves dependencies commonly known as “dependency hell” compared to rpm. rpm is not a swift dependency resolver.
. yum can fetch information from the online repository while rpm can’t connect to the online repository.
yum stands for (yellowdog updater, modified)
As I mentioned before, yum is a package manager while install is an option for the yum utility. Therefore, yum install is a command used to install packages/software.
For example, if you want to install the apache software, you will use the command,
[root@lab02 ~]# yum install httpd
Last metadata expiration check: 0:01:31 ago on Sat 18 Jan 2020 08:51:05 PM UTC.
Dependencies resolved.
===================================
Package Arch Version Repository Size
===================================
Installing:
httpd x86_64 2.4.37-16.module+el8.1.0+4134+e6bad0ed rhui-rhel-8-for-x86_64-appstream-rhui-rpms 1.4 M
Installing dependencies:
apr x86_64 1.6.3-9.el8 rhui-rhel-8-for-x86_64-appstream-rhui-rpms 125 k
apr-util x86_64 1.6.1-6.el8 rhui-rhel-8-for-x86_64-appstream-rhui-rpms 105 k
mod_http2 x86_64 1.11.3-3.module+el8.1.0+4134+e6bad0ed rhui-rhel-8-for-x86_64-appstream-rhui-rpms 158 k
httpd-tools x86_64 2.4.37-16.module+el8.1.0+4134+e6bad0ed rhui-rhel-8-for-x86_64-appstream-rhui-rpms 103 k
httpd-filesystem noarch 2.4.37-16.module+el8.1.0+4134+e6bad0ed rhui-rhel-8-for-x86_64-appstream-rhui-rpms 35 k
redhat-logos-httpd noarch 81.1-1.el8 rhui-rhel-8-for-x86_64-baseos-rhui-rpms 26 k
Installing weak dependencies:
apr-util-bdb x86_64 1.6.1-6.el8 rhui-rhel-8-for-x86_64-appstream-rhui-rpms 25 k
apr-util-openssl x86_64 1.6.1-6.el8 rhui-rhel-8-for-x86_64-appstream-rhui-rpms 27 k
Enabling module streams:
httpd 2.4
Transaction Summary
================================
Install 9 Packages
Total download size: 2.0 M
Installed size: 6.0 M
Is this ok [y/N]:
you can also see that dependencies are automatically resolved with the use of yum from the command run above.
The topic will have a part 2 as it needs to be covered extensively and due to the conventional way of Linux article write-ups on this blog site, software installation in Linux part 2 will have the “ACTION TIME” section.
Cheers!!!
Your feedback is welcomed. If you love others, you will share with others
The link to RHCSA Dumps, Q&A On Software Installation In Linux is missing. Doesnt work.
Hello Stefan,
We are still working on some of the exam practice questions. It will be updated as soon as we are done.