How to Install and Manage Packages in Linux with RPM

This guide will explain how to use RPM (the Redhat Package Manager) to install and manage software in Linux.

RPM or Red Hat Package Manager is the default package management solution for Linux distributions based on Red Hat Linux. It’s a pretty useful way to easily install, upgrade, and un-install packages on Linux machines. I remember the days when every Linux package had to be compiled. Let’s see how to perform some basic tasks with RPM.

List All Packages

Before installing a new package or upgrading and old one you sometimes want to check to make sure that it isn’t already installed. Here’s how you can get a list of all installed RPM packages:

# rpm -qa


Now a list of this kind can be pretty confusing. What I like to do is use this command along with grep. I filter the search with the package I’m looking for. So, if I’m trying to check if a certain PHP package is installed I would run the following search:

# rpm -qa | grep php


I can see what’s already installed and then decide if I need to install, upgrade, or remove anything.

Install and Upgrade Packages

There are a couple of websites I use to get my RPM packages – and RPM Find. After downloading the .rpm file here’s how you can install a package:

# rpm -ivh package-name.rpm

To upgrade a package:

# rpm -Uvh package-name.rpm

You will quite often get an error from RPM saying it needs some other packages installed to install or upgrade the package you are trying to install. This is commonly referred to as “dependancy hell”. You just have to go back to the website from where you downloaded the package and look for the packages it depends on, and install them first.

Remove Packages

Removing packages with RPM is just as simple as installing or upgrading them. You need to make sure you get the complete name of the package you are trying to remove. Use the command to list the packages as shown above to get the full name of the package. Then run the following command:

# rpm -e package-name.rpm

Beware of getting into dependancy issues here as well.

If this article helped you, I'd be grateful if you could share it on your preferred social network - it helps me a lot. If you're feeling particularly generous, you could buy me a coffee and I'd be super grateful :)

buy a coffee for

Home » Linux » How to Install and Manage Packages in Linux with RPM

Leave a Comment

Your email address will not be published.