Installing Software on RPM Based Systems
Start course
1h 20m

As the title suggests, this course looks at intermediate-level skills for those who already know a bit about Linux but want to enhance that knowledge. In this course, introduce new concepts such as job control, switching users, and installing software. 

Learning Objectives

  • Implement processes and job control, and switch between users
  • Install software using RPM- and Debian-based systems

Intended Audience

  • Anyone with basic knowledge of Linux who wants to learn more
  • Professionals who want to learn more about Linux to enhance their career prospects


This is an intermediate-level course so some knowledge of Linux is expected. If you're just starting out, then try our Linux Fundamentals course first.


Welcome to this lesson on installing and managing software on Linux systems. In this lesson, you'll learn about the two most commonly used package types and package managers. After completing this lesson, you'll know how to manage software on Red Hat Enterprise Linux, Centos, Debian, Ubuntu, and other related Linux distributions. Because installing and managing software on a Linux system is a very common task, a standard method of bundling and distributing software was created.

Package managers provide a common interface for finding, installing, and uninstalling software. Without packages and package managers the process is much more hands on and manual. It leaves things such as hosting the software files up to the developer and you as the user, the job of finding that software on the internet, plus you'll need to manually download and install the software potentially compiling it from source code.

Once you've completed this lesson you will be able to manage software installations on Linux. Specifically you'll be able to find, install and remove individual packages. Get information about a package and or determine which package to install given multiple choices. Determine if an individual package is installed, list all the packages that are installed on a system, list all the files contained within the package and find what package a particular file belongs to.

Typically when you install software on a Linux system you do so with a package. A package is a collection of files that typically make up an application. Additionally, a package contains data about the application as well as any steps required to successfully install and remove that application. The data or metadata that is contained within the package can include information such as the description of the application the version of the application and a list of other packages that it depends on.

A package manager is used to install, upgrade, and remove packages. Any additional software that is required for a package to function properly is known as a dependency. The package manager uses a packages metadata to automatically install any dependencies. Package managers keep track of what files belong to what packages, what packages are installed and what versions of those packages are installed.

Now that you have an understanding of what packages and package managers are, we can introduce the two types that you will learn how to use in this lesson. Distributions or operating systems such as Red Hat Enterprise Linux, CentOS, Alma Linux, Oracle Linux, Fedora, Scientific Linux, are all RPM-based distributions. RPM stands for Red Hat Package Manager or RPM Package Manager. Debbian, Ubuntu, Kali Linux, Linux Mint, are all of Deb based distributions or Debian based distributions.

Now here's a little obscure and fun fact. The name Debian is actually the creator's wife's name and his name combined, that being Debra and Ian. So, he called it Debian. And of course there are other distributions that use these package types, but these are the main ones you will likely encounter at home and the workplace. By the way distro is short for distribution. Also some people call distributions flavors. So just know that a distribution, a distro and a flavor mean the exact same thing and are often used interchangeably.

Now let's take a closer look at installing software on RPM-based distros. Historically the yum command line utility was the package management program for Linux distributions that use RPM packages. If you are using Red Hat 7 or CentOS7 and Earlier you will use the yum command. However, yum has been replaced with DNF starting with Red Hat 8. And we'll cover that minute. If you want to search for a package by its name or description, use yum search string where string is the thing you are searching for.

To display it information about a package use yum info package name. By the way, you can use yum info without supplying a package to get information on all packages your package manager knows about. But be careful because there are a lot of packages installed on a Linux system by default. You can also use wildcards. For example, you can run yum info bash asterisk to retrieve info on packages, starting with the letters B, A, S, H. It's important that you put the search term that contains a wildcard in quotation marks. If you fail to do that then the shell will expand the wildcard based on files in your present working directory. And then it will pass that list of files to yum instead of the wildcard itself.

Now, this might be a little confusing at this point but I'll give you a demonstration of how this works in just a minute and it will make much more sense then. For now, just be sure to use quotation marks around search terms that contain wildcards.

Okay, let's get back to what we can do with yum. To install a package use yum, install and the package name. You can use the dash Y option to automatically answer yes to yum's questions. By the way when you see something in brackets, it means it's optional. So the notation you see here on your screen means you can run yum install package or optionally yum, install dash Y package. Remember in order to install or remove a package you need to use root or super user privileges.

To remove or uninstalls the package use yum, remove followed by the package name. To update all the installed packages on the system, run yum upgrade. If you only want to update one to the latest available version supply the package name after the command. For example, you could run yum upgrade bash to ensure you have the most up-to-date version of bash on your system.

DNF has become the default package management command starting with Red Hat 8 and CentOS 8 and Later. DNF is a drop in replacement for yum. This means that any sub command you are accustomed to using with yum will work the same way with DNF. For example, DNF search works exactly the same as yum search. As a matter of fact, you can even continue using the yum command on Red Hat and CentOS 8, because yum is a symlink or a pointer to the new DNF command. So when you run yum on Red Hat 8, you're actually running DNF. If you are using Red Hat 8 I suggest that you use the DNF command instead of yum. I highly suspect feature releases will remove the ability to use the young command altogether.

In addition to the DNF command, you can use the RPM command to interact with the packages. When you use this lower level command to be aware that you do not get all the features of DNF such as automatic installation of dependencies. If you want to see all the installed packages on the system you can run RPM space QA. If you want to know which package that a file belongs to you can run RPM space dash QF space, and then the path to that particular file. Use the command RPM space dash QL space the package name to list all the files that belong to that package. If you want to install a package from a file name that packaged dot RPM, well, you would use RPM space dash ivh space package dot RPM. Use RPM dash E followed by a package name to uninstall that package.

Now remember in these command examples that you see here on the slides, the word package represents the package name. Some examples of package names could include nginx or curl or bash. This demonstration that I'm about to perform assumes that your machine has an internet connection. I'm also using CentOSfor this example, but this will work with Red Hat, Enterprise Linux, Alma Linux, Rocky Linux, Oracle Linux, and so on. So again, this is for DNF and RPM-based distributions.

Now, as I mentioned this particular Linux system has an internet connection. And by default, a package managers download packages from the internet. On a side note, package managers can be configured to pool packages from a location on a local network. This is useful on a corporate network where you have internal or private software that should only be distributed to company systems.

Okay, so let's say we want to install the nginx web server. So the first thing we would do would be to search for a package named nginx . Linux keeps a local copy of all the packages that are available and the remote repositories. Now, if that list of packages is older outdated DNF will first go ahead and download an updated list of those packages. And that's exactly what happened here at the very beginning of this command. Here the DNF search command returns a list of possible packages whose name or description contains the search string of nginx that we supplied to DNF search.

Now, one thing I want to point out here is after the period so you see period dot x86 underscored 64 or dot period noarc or noarchitecture. So these are the architecture supported by these packages. This means that this package is specifically for an x86 64 processor. This means that this is not specific to any CPU type or CPU architecture. Now out of this list of packages, I highly suspect that the first one returned Nginx, will be what we need to install. But let's go ahead and query it to get some more information about it. So we'll use DNF, info and the package name. Here we can see the version, description and other supporting information about this package.

Now to install it we need to go ahead and switch to the route user, as installing packages requires route or super user privileges. Let's use the DNF install command, to install the package. I'm going to use the dash Y option to automatically answer yes to any of DNF's questions. And I'll supply the package name of nginx. So you'll notice here that not only did the nginx package get installed but many other supporting packages were too. So in this example you just saw dependency management at work. And this is one of the key benefits of using a package manager.

We can prove nginx was installed by using the DNF list installed command. We'll use the witch command to search for the binary files path. Let's say we no longer need nginx in this site to install it. So we'll use DNF remove, and we'll also use the dash Y option again, to skip the confirmation of removal. Remember, removing software requires privileged escalation either with Sodu or SU because we are already route from the installation step we don't have to proceed the command with Sodu, for example.

So again, to remove the package, we'll run DNF remove dash Y and the package name of Nginx. If you wanna make sure that your system has all of the latest packages installed with all the latest bug fixes and security updates, run DNF upgrade. If there are any outdated packages, DNF we'll provide a list of them to you as you see here on your screen. If you want to update them then type Y and hit Enter. By the way you can also use the dash Y option here too. So, if you want to force an update without reviewing the packages first you could have run DNF upgrade dash Y.

If all of the installed packages are at the latest available versions, then DNF will report that there is nothing for it to do. Again, here, you see that there are several packages that are outdated on this particular system. So I've typed Y and now I'm going to hit Enter. And this will tell DNF to upgrade those packages to the latest version. So let's do that now. I'll go ahead and speed up the video here, so you don't have to wait the several minutes that it's going to take for this actual upgrade to complete.

Now let's take a look at the RPM command. And we can find a package from the internet, download it, and then install it using RPM. Now, keep in mind when searching for RPM packages on the internet, know that your machines, distribution and process architecture matters. Make sure that the RPM packages for your systems particular distribution of Linux. Now sometimes the same RPM can be used on multiple distros but other times there is a different RPM for each supported distro. Unless the RPM package that you are working with is labeled as noarch, meaning there is no specific processor requirement you'll need to select the correct option for your processor.

If you're using a 64 bit Intel or AMD processor, you'll look for x86 underscore 64 packages. If you're using a 64 bit ARM processor, for example you'll look for A8 or C8 64 packages. You can use the Uname command to help determine your architecture. So you use Uname space dash M, and this will print out the machine's architecture. So here I'm using an Intel CPU. So I have X86 underscore 64. So what I'm going to do right now is download a package from the internet to my local Linux system by using the curl command. Curl is mainly used to transfer data over a network, such as downloading a file. The dash capital O option causes the file to be saved locally with the same name that was used on the remote system.

This particular RPM package contains the word noarc. That means it will work no matter what CPU type I have, be it Intel, ARM or something else. So now let's go ahead and install it with the RPM command. So we'll use RPM space dash IVH, and the name of the file. So I'll example one, and I'm just going to hit Tab here to let bash auto complete that for me. So let me hit Enter. So now we see that there is a missing dependency of example, dash lib. So now I'm gonna go ahead and download and install that missing dependency manually.

After I have the dependency installed, then I can go ahead and install this original RPM that I wanted to install. Okay, I'll install it with RPM. Now I'll go ahead and install that original package from a couple of commands ago. So I'm just gonna up arrow a couple of times here and there's the package that I want to install, I'll hit Enter. By the way, if these packages were in a repository and we use the DNF command to install the example package DNF would have also downloaded and installed the example dash lib package. Dependency management is a nice feature of DNF. Just know that if you are not using DNF, you will have to perform any dependency management yourself just as you saw me do here.

Also, I quickly wanna state that if the packages do not install, that can mean you have made a typing mistake when downloading the package. If you do make a typing mistake, then you'll end up with a file that contains an HTML error message instead of the package itself. So if you run into this issue just double check your typing and try again. One way to see if the package is installed is to list all the installed packages on the system. And you can do that with RPM dash QA. The dash Q option tells RPM that we're performing a query and the A option tells RPM to return a list of all of the installed packages. So when I do that, you'll see all these packages spew to the screen, scrolling by very quickly.

A better way to find the package we just installed is by specifying it instead of scrolling through this long list and looking for it manually. So we'll do RPM dash Q example. Because we are specifying a single package, we can leave out the A option because again, A stands for all. However, we don't have to, this works as well. We'll do RPM dash QA and limited to example. If we want to list all the files included in a package we can use the RPM space dash QL command. This package only contains one file named example, and it's located in the user local bin directory. We can double-check that user local bin example actually belongs to the RPM that we just installed by using the RPM dash QF command. What is returned is the package name that the file belongs to.

Finally, let's remove the RPMs that we installed. We'll uninstall the packages in the reverse order that we installed them. If we don't do that, RPM will print an error telling us that another package depends on the one that we are trying to uninstall. Also keep in mind that we don't have to specify the architecture or file extension for the package, we can just use the package's name.

So I've just done an installed example. Now I haven't installed the example dash lib package. And to be totally certain, we uninstalled the package. We can repeat the command from earlier to search for and installed package. As you can see it says the package example is not installed. By the way if you get nothing returned as well that also means that the package was uninstalled.

Now, if you remember way back earlier in this lesson I mentioned that you could use wildcards, and I also told you to put wildcards in quotation marks. Let me demonstrate why now. So let's get some information on packages that contain the text example. The asterisk matches any character or an empty string. So asterisk example, asterisk means that the package name can have any characters before or after example. So a package named example, one, two three will match asterisk example asterisk and a package named my dash examples will also match. So let me hit Enter here.

On the screen here you'll see a package named QT5-QTXML patterns dash examples. And of course, that package matches the wildcard pattern. However, it looks at what happens if we don't enclose the wildcard search in quotation marks. Now we get a message that says, "No matching packages to list." The reason is because asterisk example asterisk was expanded first, and then that expanded content was passed to the DNF command.

Now we can demonstrate this expansion with the LS command. So I'll do LS asterisk, example asterisk. So I'm actually going to highlight this text here and copy it. So running DNF info, asterisk example asterisk is the exact same command as running what you see here on your screen. So again, the important thing here to remember is that if you are going to use wildcards, just use quotation marks.

About the Author
Learning Paths

Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.