Linux Rpm Command With Examples


What is Rpm? Rpm is package manager popular in Red Hat based operating systems.   Rpm full name is Red Hat Package Manager. Rpm uses rpm as package extension and format. Rpm packages are generally distributed from repositories on the internet but using usb, optical media or other ways is popular too in the old days. Yum is the online package manager used to get rpm packages from network or internet repositories.


Yum files are named like below with name, version,release,architecture.


As stated before repositories are used to hold rpm packages on the internet but also a CD can be used as repository in rare situations. Repositories are used but yum/dnf commands.

Rpm Search

Generally Rpm packages are provided by repository and package managers like yum, dnf. But there is alternative sites those provides Rpm packages download manually.


Source code of packages are distributed with srpm packages. Srpm packages are zipped with tar.gz or tar.bz2

PatchRPM and DeltaRpm

Rpm packages provide some options to makes download size smaller. Packages includes a lot of different type of files. But not all files are changed. To makes pacakges smaller only changed files are distributed in Deltarpm’s.

Rpm Install

Rpm packages have generally dependencies which means if we want to install some package we need to install other related packages before installing it. But We skip this and install some package with -ivh parameters.

We need root privileges to install rpm package. In our example we tried to install tmux but as we see in message it is installed all ready.

LEARN MORE  Manage Libraries With ldconfig Command In Linux

Check Dependency

As we know Rpm packages have dependencies which means to install a package other packages may be needed. The needed packages must be installed before install current package. We can check dependencies like below.

Rpm dependency check

As we see tmux package depends on sh, standard C library, ncurses, Event library etc.

Install Omitting Dependency Check

Normally if we try to install package which have unmet dependency it will give error and do not installed.  There is a way to install packages with unmet dependencies with forcefully. We will provide -nodeps parameter for installation.

Download Rpm

Yum is used to download and install automatically but in some cases we may need to download package and install another system or etc. We can download a rpm package with command named yumdownloader like below. Yumdownloader do not needs any privilege for download operation.

We only provide package name to the yumdownloader.

Check Installed RPM Package

Rpm database holds information about installed packages. we can query this database like below. If the Rpm/application is installed the full package name is printed. If the application is not install a message like package not installed gived.

List All Files Of Installed RPM Package

We may need to list files of and installed Rpm package. It is very similar to the checking process we will just add an -l parameter like below.

List files of installed packages

List Recently Installed RPM Packages

We may want to list lastly installed Rpm packages. But keep in mind that will generate a lot of line.

LEARN MORE  Linux iostat Command Tutorial With Examples

I cannot put a screenshot here because it exceeds my terminal history. So I can put some limit or pagination to this list.

List All Installed RPM Packages

Another way to list installed packages is listing all packages not just latest installed.

Using less in this situation is more practical. We can also search command output with less.


If an Rpm package is all ready installed we can upgrade existing package to newer one. Advantage of upgrade is that after upgrade old package is also hold as a backup and if new package do not work old package can be used.

Uninstall RPM Package

Uninstalling or erasing and Rpm package can be done with -e parameter like below.

Uninstall RPM Package Without Dependencies

We can only uninstall package itself and hold dependency packages in the system.

Alternative way to remove Rpm package is not erasing dependencies.

Query File Name To Find Related RPM Package

Sometimes we need to find related Rpm package from a file name.

Get Info About Installed RPM Package

We can get information about and installed Rpm package like name version, release, size, url etc.

Get Information About RPM Package

Actually Rpm provides a lot of important information about packages and its content. We can list and Rpm package information without installing it.

LEARN MORE  Linux hosts.allow and hosts.deny To Control Network Access

Query Documentation Of Installed RPM Package

Documentation of an installed Rpm package can be get like below. It is similar to finding Rpm package name from a file.

Verify RPM Package

We can check and Rpm package and verify against the Rpm database. to verify -Vp parameters should be provided.

Verify All RPM Packages

We can verify all installed Rpm packages. Verify process will look into the Rpm database to complete this job. Keep in mind that this will require a lot of time.

Import GPG Key Of RPM Package

GPG is a security protocol to verify authenticity. GPG is used recently to eliminate rouge repositories and Rpm packages but to benefit from this protocol GPG must be configured for Rpm. To configure GPG signs must be imported.

List All Imported RPM GPG Keys

We can list existing or imported GPG keys like below.

Rebuild Corrupted RPM Database

Some time Rpm database can be get corrupted. Corrupted Rpm database can not be updated or used. So to get it into working condition Rpm database should be rebuild like below.

Here we go the /var/lib and remove uncomplete database packages. Then run rpm rebuild command.


You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)