What RPM packages are and when you need them

An RPM package is a pre-built software bundle for Linux systems that use Red Hat, CentOS, Fedora, or similar distributions. Instead of downloading source code and compiling it yourself, an RPM contains the compiled program, its files, and installation instructions all in one file. When you install an RPM, the package manager unpacks everything to the right locations on your system.

You need to install RPM packages when you want to add new tools, libraries, or applications to your system. A developer might install an RPM to get a database server, a programming language runtime, or a command-line utility. The package manager handles dependencies — other packages your software needs to run — so you do not have to hunt them down manually.

RPM files end with the .rpm extension and contain metadata that tells your system what version of the software is inside, what other packages it depends on, and where files should go. You can install RPMs from your distribution's official repository (the easiest route), from a third-party repository, or from a local file you downloaded.

Key Takeaways

  • The yum or dnf command is the standard way to install RPM packages, and it automatically handles dependencies your software needs.
  • Installing from your distribution's official repository is safer and more reliable than downloading .rpm files from the internet.
  • You need root or sudo access to install packages system-wide, though some tools let you install to your user directory only.
  • If a package fails to install, check the error message for missing dependencies or conflicts with packages already on your system.
  • You can search for packages before installing them to confirm the name is correct and see what version is available.

Installing packages from your distribution's repository

The safest and fastest way to install an RPM package is through your distribution's official repository using either yum (on older systems) or dnf (on newer Fedora, CentOS 8+, and RHEL 8+ systems). Both commands do the same job; dnf is just the newer version. Open a terminal and type:

sudo dnf install package-name or sudo yum install package-name

Replace "package-name" with the actual name of what you want. For example, to install the Git version control system, you would type sudo dnf install git. The system will show you what it is about to read, ask for confirmation, then fetch the package and any dependencies it needs. The whole process usually takes seconds to a few minutes depending on package size and your internet speed.

If you are not sure of the exact package name, search first using dnf search keyword or yum search keyword. Searching for "python" will show all Python-related packages available in your repository, so you can find the exact name before you install.

Installing a local RPM file you already have

If you have downloaded an .rpm file to your computer or received one from a colleague, you can install it directly. Navigate to the folder where the file is stored, or provide the full path to the file. The command is:

sudo dnf install ./filename.rpm or sudo rpm -i filename.rpm

The dnf install method is preferred because it will still try to fetch any missing dependencies from your repository. The rpm -i command (the lowercase "i" stands for "install") will install the file but may fail if dependencies are not already on your system. If you use rpm -i and get an error about missing packages, you will need to install those dependencies first using dnf or yum.

Be cautious installing RPM files from untrusted sources. Unlike packages from your official repository, which are signed and verified, a random .rpm file from the internet could contain anything. Only install local files from sources you trust.

Checking what you have installed and removing packages

After installation, you can see what packages are on your system using dnf list installed or rpm -qa (the "qa" stands for "query all"). The rpm command will show every package; dnf list installed shows the same information in a cleaner format. Pipe the output to grep to search for a specific package: dnf list installed | grep keyword.

To remove a package you no longer need, use sudo dnf remove package-name or sudo yum remove package-name. This will uninstall the package and any packages that depend only on it. If other software on your system needs the package, the removal will fail and tell you what is blocking it.

You can also update all installed packages to their latest versions using sudo dnf upgrade or sudo yum update. This is a good practice to run periodically, especially on systems you use for development, because updates often include security fixes.

Handling dependency errors and conflicts

Sometimes an installation fails because the package you want depends on another package that is not installed, or because a newer version of a package conflicts with what you already have. When this happens, dnf or yum will print an error message explaining the problem. Read it carefully — it usually tells you exactly what is missing or what is in the way.

If a dependency is missing, you can often install it separately first using sudo dnf install dependency-name, then try installing your original package again. If there is a version conflict, you may need to update or downgrade an existing package. For example, if you need Python 3.11 but have Python 3.9 installed, you might install both side-by-side or remove the old version first.

If you get stuck, search the error message online with your distribution name — for example, "CentOS 8 dnf install error [your error message]". Other developers have usually hit the same problem and posted solutions. You can also check the package's documentation or repository page to see if there are known issues or special installation steps.

Installing from third-party repositories

Your distribution's official repository contains thousands of packages, but not everything. Some software is only available from third-party repositories maintained by the software's developers or by community projects. Before adding a third-party repository, understand that you are trusting that source to provide safe, find packages.

To add a repository, you usually install a repository configuration package using dnf or yum. For example, the EPEL repository (Extra Packages for Enterprise Linux) is added by installing the epel-release package: sudo dnf install epel-release. After that, packages from EPEL become available through your normal dnf or yum commands.

Some third-party repositories require you to import a GPG key to verify that packages are authentic. The repository documentation will tell you how to do this. Once the repository is added and the key is imported, you install packages from it the same way you install from the official repository — just use dnf install or yum install as normal.

Understanding RPM package naming and versions

RPM filenames follow a pattern that tells you what is inside. A typical name looks like package-name-1.2.3-4.el8.x86_64.rpm. Breaking this down: "package-name" is the software name, "1.2.3" is the version number, "4" is the release number (how many times this version has been packaged), "el8" means it is for Enterprise Linux 8 (CentOS 8, RHEL 8), and "x86_64" is the processor architecture (64-bit Intel/AMD).

The architecture matters. An x86_64 package will not install on an ARM system, and a 32-bit (i686) package may not work on a 64-bit system. When you search for a package using dnf or yum, the system automatically picks the right architecture for your hardware, so you usually do not have to think about this. But if you are installing a local .rpm file, check that the architecture matches your system. You can see your system's architecture by typing uname -m.

Version numbers tell you how new the software is. Higher numbers are newer. If you have version 1.2.3 installed and version 1.2.4 is available, upgrading will get you bug fixes and security patches. Major version jumps (like 1.x to 2.x) sometimes introduce breaking changes, so read the release notes before upgrading if you depend on the software.

Frequently Asked Questions

Do I need root access to install RPM packages?

Yes, installing packages system-wide requires root or sudo access because packages go into system directories that regular users cannot write to. However, some tools and languages let you install packages to your user home directory without root. For example, Python's pip can install packages per-user, and Node.js has npm for the same purpose.

What is the difference between dnf and yum?

Both commands do the same job, but dnf is the newer version with better performance and clearer error messages. Fedora, CentOS 8+, and RHEL 8+ use dnf by default. Older systems like CentOS 7 use yum. If you type dnf on a system that only has yum, it will not work, so check which one your system has or try both.

Can I install an RPM package on a Debian or Ubuntu system?

Not directly. Debian and Ubuntu use .deb packages and the apt package manager, not RPM. If you need software that only comes as an RPM, you would need to convert it or find a .deb version. Most popular software is available for both, so searching your distribution's repository first is usually faster than trying to use packages from another distribution.

What should I do if an RPM installation breaks my system?

This is rare with packages from official repositories, but it can happen. If a package causes problems, remove it using sudo dnf remove package-name or sudo yum remove package-name. If the system will not boot or you cannot access the terminal, you may need to boot into recovery mode or use a live USB to fix it. This is why testing updates on a non-critical system first is a good practice.

How do I see what files an RPM package will install before I install it?

Use rpm -qlp filename.rpm to list all files in a local .rpm file before installing it. For packages in your repository, you can use dnf repoquery -l package-name to see what files it contains. This is useful if you want to know where a package puts its files or check for conflicts with files already on your system.