LinuxRPMS documentation
The rpm command installs, upgrades, removes and inspects RPM packages on Fedora, Red Hat Enterprise Linux, AlmaLinux, Rocky Linux, openSUSE and other RPM-based distributions. This guide covers the commands you'll use most.
rpm
rpm or dnf? rpm works on one package file at a time and does not download missing dependencies. For everyday installs from a repository, use dnf (or zypper on openSUSE). Use rpm to query what's installed, check package files, and install a single .rpm you've already downloaded.
dnf
zypper
.rpm
Installing, upgrading and removing packages needs root, so run these with sudo.
sudo
sudo rpm -ivh package-name-1.0-1.el9.x86_64.rpm
-i
-v
-h
If rpm reports missing dependencies, install the file with dnf instead, which fetches them for you:
sudo dnf install ./package-name-1.0-1.el9.x86_64.rpm
sudo rpm -Uvh package-name-1.1-1.el9.x86_64.rpm
-U upgrades the package, or installs it if it isn't installed yet. To upgrade only packages that are already installed, use -F (freshen):
-U
-F
sudo rpm -Fvh *.rpm
Use the package name, not the file name:
sudo rpm -e package-name
To see what would happen without removing anything, add --test:
--test
sudo rpm -e --test package-name
rpm -qa
rpm -q package-name
rpm -qi package-name
rpm -ql package-name
rpm -qc package-name
rpm -qd package-name
rpm -qf /usr/bin/ssh
rpm -qR package-name
rpm -q --changelog package-name | less
rpm -qa --last | head
To search the list of installed packages, pipe it through grep:
grep
rpm -qa | grep -i openssl
Add -p to query an .rpm file you haven't installed yet:
-p
rpm -qip package-name-1.0-1.el9.x86_64.rpm # description and version rpm -qlp package-name-1.0-1.el9.x86_64.rpm # files it would install rpm -qRp package-name-1.0-1.el9.x86_64.rpm # what it needs
To unpack the files without installing anything, use rpm2cpio:
rpm2cpio
rpm2cpio package-name-1.0-1.el9.x86_64.rpm | cpio -idmv
Before installing a package you downloaded, check that it's signed and hasn't been changed:
rpm -K package-name-1.0-1.el9.x86_64.rpm
If the result says the key is missing, import the distribution's signing key first. For example, on AlmaLinux 9:
sudo rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux-9
To list the keys you've already imported:
rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n'
Compare installed files with what the package originally put on disk:
rpm -V package-name # one package rpm -Va # every package (slow)
No output means nothing changed. Otherwise each line starts with codes for what's different, such as 5 (contents), S (size), M (permissions) or T (modification time). A c before the file name marks a configuration file, which is often changed on purpose.
5
S
M
T
c
--queryformat (or --qf) prints just the fields you want. This lists every package with its version and size, largest first:
--queryformat
--qf
rpm -qa --qf '%{SIZE}\t%{NAME}-%{VERSION}-%{RELEASE}\n' | sort -rn | head -20
Run rpm --querytags to see every field you can use.
rpm --querytags
The package needs other packages that aren't installed. Install it with sudo dnf install ./file.rpm so dnf can fetch them. Avoid --nodeps: it installs the package anyway and usually leaves it broken.
sudo dnf install ./file.rpm
--nodeps
Use -U to upgrade instead of -i. To reinstall the same version, use sudo dnf reinstall package-name.
sudo dnf reinstall package-name
If rpm reports a damaged database, rebuild it:
sudo rpm --rebuilddb
Looking for a specific package? Sign in to your account and use Search RPMs in the dashboard, or browse the mirror directory. For anything else, email hostmaster@linuxrpms.com.