This guide walks you through installing RPM packages on CentOS Linux, covering both graphical and command-line methods. RPM (Red Hat Package Manager) is the core package format for CentOS, and you’ll learn how to use yum, dnf, and the rpm command itself to install software from local files or repositories. You’ll also see how to handle dependencies and avoid common pitfalls.
What You’ll Need
- A CentOS system (7, 8, or 9) with an active internet connection if you plan to download packages or use repositories.
- Root or sudo access to install system-wide packages.
- An RPM file (ends with
.rpm) if you’re installing locally. You can download these from official project sites or trusted mirrors. - Basic comfort with the terminal, though a graphical option is also covered.
Step-by-Step
- Check your CentOS version – Run
cat /etc/centos-releaseorhostnamectlto know whether you’re on CentOS 7 (usesyum), CentOS 8/9 (usesdnf, butyumis aliased). This determines which commands you’ll use. - Update your system (recommended) – Before installing anything, run
sudo yum update(orsudo dnf updateon 8/9) to refresh the package cache and patch existing software. This reduces dependency conflicts. - Install from a repository (easiest) – If the package is in the default repos, simply run
sudo yum install package-name(orsudo dnf install package-name). Replacepackage-namewith the actual name, e.g.,sudo yum install httpdfor Apache. The tool resolves and installs dependencies automatically. - Install a local RPM file – Navigate to the directory containing the
.rpmfile, then runsudo yum localinstall ./package.rpm(CentOS 7) orsudo dnf install ./package.rpm(CentOS 8/9). Usingyum/dnfis preferred because it pulls dependencies from repositories. - Install with the raw rpm command (if necessary) – If you must use
rpmdirectly, runsudo rpm -ivh package.rpm. The flags:-iinstall,-vverbose,-hshow hash progress. This does not resolve dependencies, so only use it when you’re sure all dependencies are present. - Handle dependencies manually (if needed) – If
rpmreports missing dependencies, you can download them from the same source or enable the EPEL (Extra Packages for Enterprise Linux) repository. For example, on CentOS 8:sudo dnf install epel-release, then retry the install. - Verify the installation – After installation, check the package is present with
rpm -q package-nameoryum list installed | grep package-name. To see files installed, userpm -ql package-name. - Run the software – Many packages add a systemd service. Start it with
sudo systemctl start service-nameand enable it to start on boot withsudo systemctl enable service-name. For command-line tools, just type the command name.
Common Mistakes
- Using
rpm -iwithout dependencies – This often fails with “failed dependencies” errors. Always preferyum/dnfwhen possible. - Downloading from untrusted sources – RPMs from random websites can be malicious or incompatible. Stick to official project sites, CentOS repos, or well-known third-party repos like EPEL.
- Ignoring architecture – A 64-bit (x86_64) RPM won’t install on a 32-bit (i686) system, and vice versa. Check with
uname -m. - Forgetting to use sudo – Installing system-wide requires root. Without
sudo, you’ll get permission denied errors. - Mixing package managers – Don’t use
rpmto install packages that were meant fordnf, as it can bypass the dependency database and leave your system inconsistent.
Tips
- Use
yum providesordnf provides– If you’re not sure which package contains a file, runsudo yum provides /path/to/fileto find it. - Enable EPEL for extra software – Many useful packages are not in the default repos. Install
epel-releasefirst, then you can install those packages normally. - Check for updates regularly – Run
sudo yum updateperiodically to get security patches and bug fixes for your installed RPMs. - Remove packages cleanly – Use
sudo yum remove package-name(ordnf remove) to uninstall, which also cleans up dependencies that are no longer needed. - Query before installing – Use
rpm -qpi package.rpmto view information about a local RPM without installing it.
Troubleshooting
- “Failed dependencies” error – This means the package needs other packages. If you used
rpm, switch toyum localinstallordnf install ./file.rpm. If that still fails, install the missing dependencies manually or enable the appropriate repository. - “Package already installed” – You might be trying to install an older or identical version. Use
rpm -Uvhto upgrade, orrpm -eto remove the old one first. - “No package available” – The package isn’t in your enabled repositories. Search with
yum search keywordordnf search keyword. If it’s not there, you may need to add a third-party repo or download the RPM manually. - “Permission denied” – You forgot sudo. Prefix your command with
sudo. - “Error: Nothing to do” – The package is already installed and up to date. Use
rpm -qto confirm. - System becomes unstable after install – This can happen if you force-installed with
--nodeps. Check for missing dependencies withrpm -Vaand consider removing the package withyum remove.
Frequently Asked Questions
Can I install an RPM without root?
No, system-wide installation requires root privileges. You can use rpm --prefix to install into a user directory, but many packages assume standard paths and may not work correctly.
What’s the difference between yum and dnf?
Yum was the default package manager in CentOS 7 and earlier. DNF is the next-generation version, default in CentOS 8 and 9. DNF is faster and has better dependency resolution, but the commands are nearly identical.
How do I uninstall an RPM?
Use sudo yum remove package-name or sudo dnf remove package-name. This removes the package and any orphaned dependencies.
Is it safe to use rpm -i –nodeps?
Generally no. It bypasses dependency checks and can break your system. Only use it in rare cases where you know all dependencies are satisfied, and even then, prefer a proper package manager.
What is EPEL and why should I enable it?
EPEL (Extra Packages for Enterprise Linux) is a repository maintained by the Fedora project that provides many additional packages not in the base CentOS repos. It’s safe and widely used.
Can I install a .rpm file from a GUI?
Yes, you can double-click an RPM file in the file manager, and the Software Center or GNOME Software will open with an install prompt. However, this method is less reliable for dependency resolution, so the command line is recommended.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix Missing Scroll Bar in Chrome
- Fix Sony Vegas Crashing on Windows 10
- Fix Outlook Sent Items Missing? Quick Solutions
- Hide WhatsApp Channel: Android & iOS Guide
- Slow Context Menu in Windows 11: Fixes
- Declutter Safari on iPhone: 15 Quick Tips