> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installing Software

> Explains Linux package management with RPM and DNF, demonstrating RPM commands, package inspection, installation, verification, and when to use higher level dependency resolution.

Administrators frequently need to install new software or tools on a Linux system. Manually downloading and installing programs can lead to dependency issues, version conflicts, and security risks. Linux distributions solve these problems using signed software repositories and package management tools that automate dependency resolution and verify package integrity.

This lesson explains how Linux handles software installation by covering:

* RPM: the low-level package format and tooling used by Red Hat–style distributions
* Common RPM commands for inspecting and manipulating package files
* A concise demo showing typical RPM workflows
* When to use a higher-level package manager such as DNF for dependency resolution and repository handling

We start with RPM (Red Hat Package Manager), the low-level tool used to manage software packages on Red Hat Enterprise Linux and related distributions. Think of an RPM file as a boxed product in a warehouse: the package contains the files and metadata required to install an application, and the package manager places those files into the correct system locations.

![A schematic titled "Package Management" showing a warehouse of boxed RPM packages being sent to a package manager. The package manager then places the packages (files) in the correct system locations.](https://mintcdn.com/kodekloud-c4ac6d9a/pGYwDVd7uFSlinOw/images/Prep-Course-Red-Hat-Certified-System-Administrator-RHCSA/Installing-Software/Installing-Software/rpm-package-manager-warehouse-install.jpg?fit=max\&auto=format\&n=pGYwDVd7uFSlinOw\&q=85\&s=a169381cde32d7b9d375d7f019c94865)

What RPM does (and what it does not)

* Installs, removes, queries, and verifies individual RPM package files
* Tracks package metadata (version, vendor, files list, checksums)
* Does not automatically resolve or fetch dependencies from repositories

For dependency resolution and repository management use DNF (which calls into RPM to perform the actual package operations).

Common RPM operations

* Install a local RPM file
* Query package metadata and contents
* List installed packages
* Verify package integrity
* Remove packages

Summary of frequently used rpm options

| Option | Purpose | Example |
| - | - | - |
| `-i` | Install a package file | `rpm -ivh package.rpm` |
| `-e` | Erase (remove) an installed package | `rpm -e package_name` |
| `-q` | Query mode | `rpm -q package_name` |
| `-qa` | Query all installed packages | `rpm -qa` |
| `-qi` | Show detailed info about an installed package | `rpm -qi package_name` |
| `-ql` | List files installed by a package | `rpm -ql package_name` |
| `-qpl` | List files in a package file (operate on a package file) | `rpm -qpl package.rpm` |
| `-qpi` | Show package file metadata | `rpm -qpi package.rpm` |
| `-V` | Verify installed package files for changes | `rpm -V package_name` |

RPM performs package installation and management but does not resolve dependencies. For typical system administration tasks use DNF, which handles dependency resolution and works with repositories while relying on RPM for the low-level package operations.

![A dark-themed presentation slide titled "Demo — Working with RPM." Two rounded content boxes read "Most common RPM operations" and "How RPM works behind the scenes."](https://mintcdn.com/kodekloud-c4ac6d9a/pGYwDVd7uFSlinOw/images/Prep-Course-Red-Hat-Certified-System-Administrator-RHCSA/Installing-Software/Installing-Software/rpm-demo-operations-how-it-works.jpg?fit=max\&auto=format\&n=pGYwDVd7uFSlinOw\&q=85\&s=875840b3d066d62162c8db7440e9b905)

Demo — working with an RPM package

The following concise demo shows common RPM commands and their outputs. The prompt is the root account (`root@control`), so `sudo` is not used.

1. Confirm the RPM file exists in the current directory:

```bash theme={null}
root@control:~# ls
anaconda-ks.cfg  systemjob  tree-2.1.0-8.el10.x86_64.rpm
root@control:~#
```

2. Inspect package file metadata (query a package file):

```bash theme={null}
root@control:~# rpm -qpi tree-2.1.0-8.el10.x86_64.rpm
Name        : tree
Version     : 2.1.0
Release     : 8.el10
Architecture: x86_64
Install Date: (not installed)
Group       : Unspecified
Size        : 110278
License     : GPL-2.0-or-later AND LGPL-2.1-or-later
Signature   :
            RSA/SHA256, Thu 23 Jan 2025 05:00:49 PM EET, Key ID 199e2f91fd431d51
Source RPM  : tree-pkg-2.1.0-8.el10.src.rpm
Build Date  : Wed 08 Jan 2025 03:49:50 PM EET
Build Host  : x86-vm-05.brew-001.prod.iad2.dc.redhat.com
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : https://mama.indstate.edu/users/ice/tree/
Summary     : File system tree viewer
Description :
The tree utility recursively displays the contents of directories in a
tree-like format. Tree is basically a UNIX port of the DOS tree utility.
root@control:~#
```

3. List the files that would be installed by the package:

```bash theme={null}
root@control:~# rpm -qpl tree-2.1.0-8.el10.x86_64.rpm
/usr/bin/tree
/usr/lib/.build-id
/usr/lib/.build-id/bc
/usr/lib/.build-id/bc/1e41176e70a5f8033db0f8d234d9948d4adcb0
/usr/share/doc/tree
/usr/share/doc/tree/README
/usr/share/licenses/tree
/usr/share/licenses/tree/LICENSE
/usr/share/man/man1/tree.1.gz
root@control:~#
```

4. Install the package (if not already installed):

```bash theme={null}
root@control:~# rpm -ivh tree-2.1.0-8.el10.x86_64.rpm
Verifying...
#########################################  [100%]
Preparing...
#########################################  [100%]
package tree-2.1.0-8.el10.x86_64 is already installed
root@control:~#
```

(The output above indicates the package was already present on the system.)

5. Verify the package is installed and display short and detailed info:

```bash theme={null}
root@control:~# rpm -q tree
tree-2.1.0-8.el10.x86_64
root@control:~# rpm -qi tree
Name                      : tree
Version                   : 2.1.0
Release                   : 8.el10
Architecture              : x86_64
Install Date              : Tue 31 Mar 2026 01:58:12 PM EEST
Group                     : Unspecified
Size                      : 110278
License                   : GPL-2.0-or-later AND LGPL-2.1-or-later
Signature                 :
                         RSA/SHA256, Thu 23 Jan 2025 05:00:49 PM EET, Key ID 199e2f91fd431d51
Source RPM                : tree-pkg-2.1.0-8.el10.src.rpm
Build Date                : Wed 08 Jan 2025 03:49:50 PM EET
Build Host                : x86-vm-05.brew-001.prod.iad2.dc.redhat.com
Packager                  : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor                    : Red Hat, Inc.
URL                       : https://mama.indstate.edu/users/ice/tree/
Summary                   : File system tree viewer
Description               :
The tree utility recursively displays the contents of directories in a
tree-like format.  Tree is basically a UNIX port of the DOS tree utility.

root@control:~#
```

6. Find which installed package owns a specific file:

```bash theme={null}
root@control:~# rpm -qf /usr/bin/tree
tree-2.1.0-8.el10.x86_64
root@control:~#
```

7. Remove the package:

```bash theme={null}
root@control:~# rpm -e tree
root@control:~#
```

8. Confirm the package was removed:

```bash theme={null}
root@control:~# rpm -q tree
package tree is not installed
root@control:~#
```

Additional useful RPM operations

* Verify an installed package’s integrity and detect changed files: `rpm -V package_name`
* List all installed packages: `rpm -qa`
* Operate directly on package files with `-p` variants (e.g., `rpm -qpi package.rpm`, `rpm -qpl package.rpm`)

Best practices and next steps

* Use RPM for low-level inspection, verification, and manual installs from `.rpm` files.
* For routine software installation, updates, and repository management use DNF (it resolves dependencies, fetches packages from configured repositories, and signs metadata).
* Always prefer signed repository sources and verify package signatures when available.

Links and references

* RPM manual: [https://rpm.org/](https://rpm.org/)
* DNF documentation: [https://dnf.readthedocs.io/](https://dnf.readthedocs.io/)
* Red Hat Package Management concepts: [https://access.redhat.com/documentation/en-us/red\_hat\_enterprise\_linux/](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/) (search "rpm" or "dnf")

> [card] [Watch Video](https://learn.kodekloud.com/user/courses/red-hat-certified-system-administrator-rhcsa/module/a16261b2-a01f-4d77-8123-ca2fe5359edd/lesson/6172cde4-dbef-462e-8861-244ae25357d3)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.