Updated: 18 October 2026 · Applies to: RPM 4.16.1.3 on AlmaLinux 9.8, RPM 4.19.1.1 on AlmaLinux 10.2 and RPM 6.0.2 on Fedora 44, tested (Rocky Linux 9.8 and 10.2 ship the same 4.16.1.3 and 4.19.1.1)

rpm is the low-level package tool of AlmaLinux, Rocky Linux, RHEL and Fedora. It installs, queries, verifies and removes .rpm packages, but it does not download anything or fetch missing dependencies. These are the commands you will use most:

rpm -qa                    # list every installed package
rpm -q bash                # is bash installed, and which version?
rpm -qi bash               # package details
rpm -ql bash               # files the package installed
rpm -qf /etc/passwd        # which package owns this file?
rpm -V bash                # check the package's files for changes
rpm -ivh package.rpm       # install a package file
rpm -e package             # remove a package (by name, not file name)

For everyday installs, use dnf install ./package.rpm: dnf calls rpm for you and fetches the dependencies. Check your version with rpm --version. The output below is a lab example from test containers; your package versions will differ.

1. Install (set up) an .rpm file

  1. Get the package file. To fetch one from your repositories without installing it:
    $ dnf download tree
    $ ls tree*.rpm
    tree-2.1.0-8.el10.x86_64.rpm
    On Fedora 44, dnf download jq saved both the i686 and the x86_64 file, and installing ./jq-*.rpm then pulled in 32-bit glibc. Ask for one architecture with dnf download --arch x86_64 jq.
  2. Check the signature and the contents before you install:
    $ rpm -K tree-2.1.0-8.el10.x86_64.rpm
    tree-2.1.0-8.el10.x86_64.rpm: digests signatures OK
    $ rpm -qpi tree-2.1.0-8.el10.x86_64.rpm    # description, version, vendor
    $ rpm -qpl tree-2.1.0-8.el10.x86_64.rpm    # files it will install
    $ rpm -qpR tree-2.1.0-8.el10.x86_64.rpm    # what it needs
    The p means "package file" instead of an installed package. If rpm -K reports a missing key, import the vendor's key only from a source you trust (rpm --import KEYFILE).
  3. Install it with dnf, which resolves dependencies:
    dnf install ./tree-2.1.0-8.el10.x86_64.rpm
    Check the file with rpm -K first: for a local file, dnf5 on Fedora 44 printed Warning: skipped OpenPGP checks for 2 packages from repository: @commandline.
  4. Or install it with rpm alone:
    $ rpm -ivh tree-2.1.0-8.el10.x86_64.rpm
    Verifying...                          ########################################
    Preparing...                          ########################################
    Updating / installing...
    tree-2.1.0-8.el10                     ########################################

The install modes are -i (install), -U (upgrade, or install if it is not there yet) and -F (upgrade only if an older version is installed). -v prints the package names, -h the progress bars, and --test runs the checks without installing anything.

If a dependency is missing, rpm stops and lists it:

$ rpm -ivh jq-1.7.1-11.el10_2.2.x86_64.rpm
error: Failed dependencies:
	libonig.so.5()(64bit) is needed by jq-1.7.1-11.el10_2.2.x86_64

Install that file with dnf install ./jq-1.7.1-11.el10_2.2.x86_64.rpm instead, which added oniguruma automatically. To download a package together with all its dependencies, see How to Download RPM Packages with Dependencies Using dnf.

rpm on Ubuntu or Debian: apt install rpm works (it gave RPM 6.0.1 on Ubuntu 26.04), but that rpm has its own, empty database: rpm -qa | wc -l printed 0, and apt knows nothing about packages installed with it. Use it to inspect .rpm files only, and install the vendor's .deb instead, or convert the package with Alien.

2. Query installed packages

$ rpm -qa | wc -l
159
$ rpm -qa 'open*'
openssl-fips-provider-3.5.8-1.el9_8.x86_64
openssl-libs-3.5.8-1.el9_8.x86_64
openssl-3.5.8-1.el9_8.x86_64
openldap-2.6.8-4.el9.x86_64
$ rpm -q openssh-server
package openssh-server is not installed

rpm -q returns exit code 0 when the package is installed and 1 when it is not, so scripts can test it. More queries:

rpm -qi bash              # name, version, licence, signature, build date
rpm -ql bash              # all its files
rpm -qc bash              # only its configuration files
rpm -qd bash              # only its documentation
rpm -q --changelog bash | head
rpm -q --requires tar     # what tar needs
rpm -q --whatrequires bash          # installed packages that need bash
rpm -q --whatprovides 'libonig.so.5()(64bit)'

Find the package that owns a file. This only works for installed files; for a file you do not have yet, ask the repositories with dnf provides '*/bin/dig'.

$ rpm -qf /etc/passwd
setup-2.13.7-10.el9.noarch
$ rpm -qf $(command -v tar)
tar-1.34-13.el9_8.x86_64
$ rpm -qf /usr/local/bin/myscript
error: file /usr/local/bin/myscript: No such file or directory

The newest installs first, and your own output format with --qf:

$ rpm -qa --last | head -2
krb5-libs-1.21.3-10.el10_2.x86_64             Fri Oct  2 09:04:56 2026
rootfiles-8.1-54.el10.noarch                  Fri Oct  2 09:04:45 2026
$ rpm -q --qf '%{NAME} %{VERSION}-%{RELEASE} %{ARCH}\n' bash
bash 5.1.8-9.el9 x86_64
$ rpm -qa --qf '%{SIZE}\t%{NAME}\n' | sort -rn | head -3
33022155	python3-libs
25215083	binutils
13443471	glib2

The last command lists the largest packages in bytes. What the parts of a name such as 5.1.8-9.el9 mean is explained in Understanding RPM Versions and Naming Schemes; for file locations on Debian and Ubuntu too, see How to Find Where a Package Installed Its Files.

3. Verify a package

rpm -V package compares the installed files with the RPM database. No output means nothing changed. We changed the permissions of /usr/bin/tree, edited its README and appended a line to /etc/bashrc:

$ rpm -V tree
.M.......    /usr/bin/tree
S.5....T.  d /usr/share/doc/tree/README
$ rpm -V setup
S.5....T.  c /etc/bashrc

According to the rpm manual, the codes mean: S size, M mode (permissions or file type), 5 digest (content), D device number, L symlink target, U owner, G group, T modification time, P capabilities. A dot means that test passed. The letter before the path marks the file type: c configuration, d documentation, g ghost, l licence, r readme. A line starting with missing means the file is gone.

  1. Changed configuration files (c) are usually your own edits.
  2. Changed programs in /usr/bin, /usr/sbin or /usr/lib deserve a closer look.
  3. Reset owner, group, permissions and time with rpm --restore tree. In our tests this fixed a .M...U... line on RPM 4.16 and 6.0.
  4. Changed content (5) needs the original file back: dnf reinstall tree, after which rpm -V tree printed nothing.

rpm -Va checks every package and takes a while; expect many c lines on a server you have configured.

4. Remove a package

$ rpm -e tree
$ rpm -q tree
package tree is not installed

rpm refuses to remove a package that another one needs:

$ rpm -e oniguruma
error: Failed dependencies:
	libonig.so.5()(64bit) is needed by (installed) jq-1.7.1-11.el10_2.2.x86_64

Remove both together (rpm -e jq oniguruma), check first with rpm -e --test, or use dnf remove jq. Avoid --nodeps: it leaves the other package broken. When both architectures of a package are installed, rpm asks you to choose:

$ rpm -e jq
error: "jq" specifies multiple packages:
  jq-1.8.1-3.fc44.x86_64
  jq-1.8.1-3.fc44.i686

Give the full name (rpm -e jq-1.8.1-3.fc44.i686) or add --allmatches to remove all of them.

5. What differs between RPM 4.16, 4.19 and 6.0

  • Database location: rpm --eval '%{_dbpath}' printed /var/lib/rpm on AlmaLinux 9 and /usr/lib/sysimage/rpm on AlmaLinux 10 and Fedora 44, where /var/lib/rpm is a link to it.
  • Signing keys: rpm -q gpg-pubkey lists the imported keys on all three. RPM 4.19 and 6.0 also have rpmkeys --list; RPM 6.0 shows the full key fingerprint.
  • Signature check: rpm -K ends with digests signatures OK everywhere, but rpm -Kv on RPM 6.0 prints Header OpenPGP V4 RSA/SHA256 signature, key fingerprint: ...: OK, and for the Fedora 44 package it listed only SHA256 digests (no SHA1 or MD5).

Common problems

New to RPM packages? Start with the Beginners Guide to Linux Software Management with RPM.

Official documentation: RPM documentation.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket