On Unix/Linux systems, RPM is a command-line tool for managing packages. It allows you to update, inspect, delete, and install RPM packages. It only supports the. rpm file format and is the system’s primary package manager for Red Hat-based systems. These packages can be installed using the rpm or yum commands. With the help of clear examples, you will learn how to utilize the rpm commands from here. Our vps hosting in France accommodates 13k+ businesses seamlessly where those websites are getting powerful features with huge storage.

For systems that make use of the RPM package format, such as Red Hat Enterprise Linux, CentOS, and Fedora. The RPM (Red Hat Package Manager) command is an essential component of the Linux ecosystem. Knowing how to utilize the RPM command properly can greatly improve your capacity to manage software packages. Whether you’re a system administrator, developer, or interested Linux enthusiast. For those looking to streamline their software installation process on Linux, exploring the methods outlined in How to Install RPM File on Linux OS can greatly enhance your package management skills.

Linux RPM Command Syntax

The Canadian vps hosting features a stable day-night support structure with an unmetered NVME SSD server and bandwidth. Coming back, The command’s fundamental syntax is as follows:

sudo rpm [option] [package_name]

Run: to view a complete list of command options.

sudo rpm --help

full list command options help command

Command options for RPM

The most common rpm command options and their descriptions can be found here.

  • -e, –erase: Uninstall the relevant package(s).
  • -h, –hash: As the package is being installed, print hash marks.
  • -i, –install: install the required package(s).
  • -l, –list: List the package’s files.
  • -q, –query: package(s) of queries.
  • -s, –state: Show the file states that are listed.
  • -U, –upgrade: packages for upgrades.
  • -v, –verbose: -Offer a more thorough output.
  • -V, –verify: Check the package(s).

Example Commands for RPM

The rpm command is easy to use and lets you tailor each query by mixing different arguments. Examine some of the most popular commands mentioned below, then use a sample package to see how they operate.

Here are the Commands to Install RPM Packages

Use the following syntax when using the RPM command to install RPM packages:

sudo rpm -ivh package_name

The command offers the following choices:

  • -i Install
  • -v (Velocity Output)
  • To display the installation process, use the -h option.

You must download the proper file before installing it. The package must be compatible with the machine’s system architecture. For instance, you would run: to install the MySQL package.

sudo rpm -ivh mysql80-community-release-el7-5.noarch.rpm

Provide the following URL to install an RPM package without first downloading it:

sudo rpm -ivh package_URL

Example:

sudo rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm

install RPM package without previously downloading

RPM Packages Upgrade

RPM replaces an outdated version with the most recent one when upgrading a package.

The upgrade command for a package is as below:

sudo rpm -Uvh package_name
  • -u Upgrade
  • -v (Velocity: Verbose)
  • -h (Print hash marks to demonstrate the upgrading process)

Use: To Update MySQL

sudo rpm -Uvh mysql80-community-release-el7-5.noarch.rpm

use command to upgrade rpm package

You must manually install any additional dependencies that the new version may require. After executing the command, RPM displays a list of the dependencies that were missing. Add the –nodeps argument to the command if you want to disregard the notice and update without the dependencies:

sudo rpm -Uvh --nodeps package_name

Delete the RPM packages.

Making use of the -e (–erase) option, remove RPM packages:

sudo rpm -e package_name

Add the -v argument to the command in order to see the verbose output:

sudo rpm -ev package_name

Add –nodeps to an RPM package to delete it without destroying its dependencies.

sudo rpm -ev --nodeps package_name

For instance, you can run to get rid of MySQL without getting rid of its dependencies.

sudo rpm -ev --nodeps mysql80-community-release-el7-5.noarch

without removing dependencies delete rpm packages

Display Package Details Following Installation

Use the -qi option to tell RPM to query info in order to see the information that is currently available about an installed RPM package:

sudo rpm -qi package_name

The output shows the software version, installed details, and a succinct description.

Run the Command for MySQL.

sudo rpm -qip mysql89-community-release-el7-5.noarch

after installing display package information

Before Installing, Display the Package Information

The following command can be used to view package details before installation:

sudo rpm -qip package_name

The command offers the following choices:

  • -qi (query Information)
  • -p (quickly check a package)

Use the following command to display information prior to installing the MySQL package:

sudo rpm -qip mysql89-community-release-el7-5.noarch

output displaying package information before installing

Before Installing, Look up Package Dependencies.

Prior to installing packages on the system, RPM enables you to examine the dependencies of those packages. Keep in mind that to view a list of dependencies, you must have the RPM package locally downloaded.

The instruction to do so is:

rpm -qpR package_name

Options include:

  • -q (Queries format)
  • -p (quickly check a package)
  • -R (List package dependencies)

For instance, you can run: to show the prerequisites for installing the MySQL RPM package.

rpm -qpR mysql80-community-release-el7-5.noarch

Check Packages

Verifying packages entails comparing installed file information with metadata from the RPM database.

The command will allow you to confirm every installed package.

sudo rpm -Va
  • -V (verify)
  • -a (all)

Run the command to confirm a specific package.

sudo rpm -Vp package_name
  • -v (verify)
  • -p (Package)

Verify the MySQL installation package using:

sudo rpm -Vp mysql80-community-release-el7-5.noarch.rpm

verify rpm package

Seek Out Manual Pages

Use the -qdf option to list the available documentation for an installed RPM package:

sudo rpm -qdf package_name

The available commands are:

  • -q (Queries format)
  • -d (List documentation files (command-d)
  • -f (search for the package owning file)

Use the following command to look for MySQL manual pages:

sudo rpm -qdf mysql80-comunity-release-el7-5.noarch.rpm

related to installed rpm package list available documentation

List Every File in a Package That Is Installed

Use the -ql option to tell RPM to query the list in order to view extensive information about a package by listing all of its files:

sudo rpm -ql package_name

For instance, you can run: to list the files in the sample MySQL package.

sudo rpm -ql mysql80-community-release-el7-5.noarch

list all files of an installed rpm packages

Installed Packages List

Run the following commands to get a list of every RPM package that has been set up on the system:

sudo rpm -qa

The -qa parameter in the command directs RPM to query all.

Recent Packages Installed List

Use the –last attribute with the -qa (query all) option to see a list of all recently installed packages:

sudo rpm -qa --last

The output lists every RPM package that has been installed, with the most recent item listed first.

Final Words on Checking RPM Command in Linux

Hope you have learned how to install, check, upgrade, and delete packages using the rpm command. It is still advised to use the yum or dnf command for similar tasks because they take care of dependencies. Hope this has helped you with How to Use the rpm Linux command.

By now, you ought to have no trouble navigating the RPM environment. Utilizing its strength to keep an orderly software environment. You’ll develop a greater understanding of RPM’s contribution to dependability. The usefulness of your Linux system as you continue to research and interact with it.