There are a few different ways that you can install an RPM package on RHEL 8 / CentOS 8 as oppose to package installation from a systems repository. They each have their own merits, but DNF should probably be your first choice in most situations. It’s also good to remember that, for stability’s sake, it’s a good idea to limit your external RPM installs as much as possible.
In this tutorial you will learn:
- How to Install an RPM with DNF
- How to Install an RPM with Yum
- How to Install an RPM with RPM
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||RHEL 8 / CentOS 8|
|Software||DNF, Yum, and RPM|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to Install an RPM with DNF
As stated earlier, DNF is Red Hat’s package manager, and it’s the best option for handling individual RPM packages. DNF handles dependency resolution, and that’s a very big deal when dealing with individual packages on any Linux system. It prevents potential conflicts and semi-broken packages. You’ll also be spared the hassle of tracking down dependencies yourself.
To install an RPM with DNF, simply give DNF the location of the RPM instead of the package name, like you normally would.
# dnf install /path/to/package.rpm
It works with RPMs located on the web too. Give DNF the direct web address of the RPM.
# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
DNF will automatically include any dependencies in the installation, and it shows them when it asks you to confirm the package install. In the case the package isn’t compatible, DNF will let you know that too.
How to Install an RPM with Yum
This section will be brief. Yum on RHEL 8 / CentOS 8 is DNF. With this release, Red Hat removed Yum in favor of DNF, but they provided a simple wrapper, allowing you to continue using the
yum command. So, if you want to use “Yum” to install an RPM, you can, but it’s really DNF, and the syntax is identical.
# yum install /path/to/package.rpm
How to Install an RPM with RPM
The traditional method for installing RPM packages is the RPM package utility. It’s the original way to install packages on a Red Hat system, and it does still work, but it has its limitations. Most notably, RPM doesn’t handle dependency resolution. That means, if you’re going to go this route, be prepared because things can get messy fast.
To use install a package with the
rpm command, use the
-i flag, and give it the path to your package.
# rpm -i /path/to/package.rpm
Stick to DNF for most situations, and things will go smoothly. While you might need to use RPM in some rare niche situations, DNF will almost always be the best bet, especially considering dependencies.