RPM is a package manager for Linux that installs, updates, removes, and verifies software packages using the RPM file format.
Where it fits: RPM stands for RPM Package Manager (originally Red Hat Package Manager), and it is used primarily on distributions like Red Hat Enterprise Linux, Fedora, CentOS, and openSUSE. Look for commands starting with rpm or files ending in .rpm to know you're working with this system.
What RPM Packages Contain
An RPM file bundles compiled software along with metadata: the program name, version, dependencies, installation scripts, and file locations. This lets RPM know which other packages must be present before installing, and where to place each file on your system. When you install a package, RPM reads its metadata and checks your system first, then writes files and runs setup scripts if everything matches.
Dependencies tell RPM what other software must already be installed. If a package needs a library that isn’t present, RPM will show an error and stop. You can ignore this check with special flags, but doing so often breaks the software. RPM also stores the list of installed files so it knows exactly what to remove later, without leaving stray files behind.
Common Package Operations
You can query installed packages to see what version you have, list all files they installed, or check if a specific file belongs to any package. For example, you might want to know which package owns a config file, or verify that a program’s files haven’t been changed or corrupted. These queries help troubleshoot missing or altered files without opening each package manually.
Upgrading replaces an older version of a package with a newer one while keeping configuration files in place, if possible. Removing a package deletes its files and runs cleanup scripts, but RPM does not automatically remove packages that were installed only as dependencies—those remain unless you ask it to. You can list all installed packages to audit what’s on your system, or search by name or description to find something you remember only vaguely.
How RPM Compares to Other Tools
On Debian-based systems like Ubuntu, the equivalent tool is dpkg, used with .deb files. Both RPM and dpkg work at the package level, not the individual file level. Higher-level tools like dnf (for newer Red Hat systems) or apt (for Debian) sit on top and handle dependencies automatically, downloading from online repositories instead of requiring you to find files manually.
Some distributions use RPM as their base but add layers: Fedora and RHEL rely on dnf to fetch and install RPMs from repositories, while openSUSE uses zypper. You can still run rpm directly, but most users prefer the higher-level tool because it resolves dependencies and checks for updates. If you download an RPM file from a vendor’s website, you’ll use rpm directly; if you install from the distribution’s own software center or command-line tool, it will call rpm for you behind the scenes.
Verifying Installed Software
One useful feature is checking installed packages for changes. RPM can compare each file’s size, checksum, permissions, owner, group, and modification time against the values it recorded when the package was installed. If something differs—a file was edited, deleted, or replaced—you’ll see a report listing the differences. This helps detect accidental changes or possible tampering, though it does not fix anything by itself.
Running verification on a single package is quick, but checking the entire system takes longer. You can narrow it to critical directories, like /etc for configuration files, or to a known program name. If a verification fails, you can reinstall the package to restore the original files, or manually edit the affected ones if you want to keep your changes and just update the RPM database to match.
Working with Source and Binary RPMs
There are two main kinds of RPM files: binary and source. Binary RPMs contain pre-compiled programs ready to install. Source RPMs (often named with .src.rpm) hold the original source code, patches, and build instructions. You can rebuild a source RPM into a binary one tailored to your system—changing compiler flags, enabling extra features, or fixing a bug before compiling.
Rebuilding requires tools like rpm-build and any libraries mentioned in the package’s dependencies. You unpack the source RPM, apply its patches, configure the build, then compile and package the result. This is common for developers or system administrators who need custom behavior, but most users skip this step and install binary packages directly.
Signing and Trust
RPM supports cryptographic signatures so you can verify that a package came from a trusted source and wasn’t altered. The package creator signs it with a private key; you import their public key into your RPM database, then ask RPM to check the signature before installing. If the signature doesn’t match, RPM refuses to install unless you override the check. This guards against tampered or counterfeit packages, especially when downloading from unofficial sites.
You can list all trusted keys to see who your system accepts by default, or add a new one from a file or key server. Some distributions sign all official packages, so you don’t need to do anything extra. If you build your own packages, you can generate your own key pair and sign them for internal use, making sure only people with your public key accept the packages.
Common Errors and Fixes
One frequent problem is dependency conflicts: a package needs a specific version of another package, but you have a different one installed. RPM will not install unless you match the version or upgrade/downgrade the dependency. You can force it with flags, but that often breaks other software. The safer fix is to upgrade or install the needed version first, or use a higher-level tool that handles this automatically.
Another issue is file conflicts: two packages claim ownership of the same file path. RPM stops installation to avoid overwriting. You can ask it to overwrite the file, but you’ll lose the other package’s version. The right fix is usually to remove one of the conflicting packages, or ask the vendor to update their package to use a different path.
When RPM Asks for Confirmation
Some operations prompt for yes or no, especially removals or upgrades. You can skip prompts by adding flags, but that’s risky on production systems. For unattended scripts, use flags like --quiet or --noscripts carefully, knowing you’re disabling safety checks. Always test flags on a non-critical machine first, especially when changing how dependencies are handled or skipping verification steps.
Where RPM Lives in Your System
RPM stores its database in /var/lib/rpm, which records every installed package, its files, and metadata. This database grows as you install software, and it’s what RPM queries when you ask what’s installed or what owns a file. Never delete or edit this directory manually—use RPM commands instead. If the database becomes corrupted, reinitializing it is possible but requires rebuilding from installed packages, which is a complex procedure best avoided unless absolutely necessary.
Logs of RPM actions go to /var/log/rpmpkgs and sometimes to /var/log/yum.log if a higher-level tool was used. These help track when a package was added or removed, useful for auditing changes over time. You can also see recent actions by listing installed packages in order of installation date, which shows which software was added most recently.