What is rpm package in linux

How to Use RPM Command in Linux

If you’re a Linux user, you’ve likely come across the term RPM. RPM is an acronym for Red Hat Package Manager, and it is a powerful command-line tool for managing software packages on Linux systems. This article will cover everything you need to know about the RPM command in Linux, including its syntax, usage, and some common examples.

1: What is the RPM Command

The RPM command is a software management tool for Linux operating systems. It is used to manage the installation, removal, verification, and upgrading of software packages. RPM is designed to work with packages that are in the RPM format, which is a binary format that contains all the files necessary for installing and running the software.

2: RPM Command Syntax

The basic syntax of the RPM command is as follows:

Here, [OPTIONS] refers to the command options that you can pass to the RPM command, and [PACKAGE] refers to the package that you want to manage.

3: RPM Command Options

To check the complete list of command options, run:

Text Description automatically generated

Here are some commonly used options for the RPM command:

-i: install a package

-U: upgrade a package

-e: erase/remove a package

-q: query a package

-V: verify a package

-F: freshen an installed package

-h: display help for a specified RPM command

-v: verbose mode (displays more detailed output)

–test: test mode (simulate the specified command without performing it)

–nodeps: skip dependency checks when installing, upgrading, or removing a package

Note that there are many more options available for the RPM command, and you can find a complete list in the RPM manual page by running man rpm in your terminal.

Graphical user interface, text, application, email Description automatically generated

4: Install RPM Packages

To install an RPM package using the rpm command, follow this syntax:

This command includes the options

  • -i for install
  • -v for verbose output
  • -h to print hash marks to indicate the progress of the installation process

Before installing, ensure that you have downloaded the appropriate package file compatible with your system architecture.

For example, to install the vim-enhanced rpm package, use the following command:

We can also install an RPM package with download link using the following command:

Читайте также:  Установка промежуточного сертификата astra linux

5: Upgrade RPM Packages

During an RPM upgrade, the current version of the package is uninstalled, and the latest version is installed.

The following command can be used to upgrade packages:

This command includes the options

To upgrade vim-enhanced, use:

Graphical user interface, text, application Description automatically generated

Manually installing additional dependencies may be required if the new version requires them. In the output after running the command, RPM shows the required dependencies that are missing.

Add the –nodeps option to the command to ignore the message and update without dependencies:

6: Remove RPM Packages

To remove RPM packages, run:

For example, to remove the vim-enhanced RPM, run:

Using yum is another option for uninstalling RPM packages.

For example, to remove vim using yum command run:

7: List Installed RPM Packages

Run the following command to list all installed RPM packages:

The command includes the -qa option, which instructs RPM to query all.

8: Display Package Information Before Installing

Before installing a package, the following command displays information about the RPM package:

To obtain information about a package and confirm its validity, use the options:

For example, to display the information related to vim-enhanced RPM package run:

Text Description automatically generated

9: Display Package Information After Installing

An RPM package’s available information can be viewed by using the -qi option, which instructs the program to query the package details:

The output gives us information such as package details.

For example, the following command will give us info related to vim-enhanced:

Graphical user interface, text Description automatically generated

10: Check RPM Package Dependencies Before Installing

The RPM commands also allow us to check the dependencies of packages before we can install them. Make sure the RPM package is already downloaded for which you want to see the list of dependencies.

The command syntax we use is:

Following is the list of options this command includes:

For example, to list all required dependencies by vim-enhanced package you can run:

Graphical user interface, text, application, email Description automatically generated

11: List All Files of an Installed Package

We can also list all the files associated with a package using -ql option, this will instruct RPM to query the list:

For example, we can list vim-enhanced rpm package files using:

Graphical user interface, text, application Description automatically generated

12: RPM Command in Different Linux Distros

While the RPM command works similarly across different Linux distributions, there may be some differences in usage and syntax. Here’s a brief overview of RPM commands in different Linux distros:

RPM Package Management in Red Hat-Based Systems

In Red Hat-based systems, RPM is the default package manager. The RPM package management system is used to manage software packages in these systems. To install a package in a Red Hat-based system, you can use the following command:

To remove a package, you can use the following command:

RPM Package Management in Debian-Based Systems

In Debian-based systems, the default package manager is apt. However, you can still use RPM to manage packages in these systems.

RPM is a package manager for the Red Hat system so by default it is not installed on Debian. To install the RPM package manager in a Debian-based Linux system, run:

Text Description automatically generated

To install a package in a Debian-based system using RPM, you can use the following command:

Note: The alien utility will convert the RPM package to deb, which you can install using the following command:

Читайте также:  Добавить пользователя через консоль линукс

RPM Package Management in Arch-Based Systems

In Arch-based systems, the default package manager is pacman. However, you can still use RPM to manage packages in these systems. To install a package in an Arch-based system using RPM, you can use the following command:

Conclusion

The RPM command is a powerful tool for managing software packages in Linux. Whether you’re installing new packages, upgrading existing ones, or removing old ones, RPM makes it easy to keep your system up-to-date and running smoothly. By following the tips and tricks mentioned in this article, you can become proficient in using the RPM command for managing software packages.

About the author

Kashif

I am an Electrical Engineer. I love to write about electronics. I am passionate about writing and sharing new ideas related to emerging technologies in the field of electronics.

Источник

How to Use the RPM Command in Linux

RPM is a command-line utility for managing packages on Unix/Linux systems. It allows you to install, query, update, verify and remove RPM packages.

It is the default package manager for Red Hat based systems and only works with the .rpm format. You can install such packages using the rpm or the yum command.

In this article, you will learn how to use rpm commands with easy-to-follow examples.

How to use the RPM command in Linux.

Prerequisites

  • A system running Linux.
  • Access to the command line/terminal.
  • Access to root or an account with sudo privileges.

Linux RPM Command Syntax

The basic syntax for the command is:

sudo rpm [option] [package_name]

To see a full list of command options, run:

Display RPM command help message.

RPM Command Options

Below you will find the most popular command options used with the rpm command and their meaning.

-e , —erase Remove (uninstall) package(s).
-h , —hash Print hash marks as the package installs.
-i , —install Install package(s).
-l , —list List files in a package.
-q , —query Query package(s).
-s , —state Display the state of the listed files.
-U , —upgrade Upgrade package(s).
-v , —verbose Provide more detailed output.
-V , —verify Verify package(s).

RPM Command Examples

The rpm command is simple to use and allows combining multiple options to customize each query. Explore some of the most commonly used commands listed below and try out how they work with a sample package.

Install RPM Packages

To install RPM packages with the rpm command, use the syntax:

sudo rpm -ivh package_name

The command includes the options:

Before installing, you need to download the appropriate file. The package has to be compatible with the system architecture of the machine.

Note: To download packages, use the curl or wget command.

For instance, to install the MySQL package, you run:

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

To install an RPM package without previously downloading it, provide the URL:

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

Install an RPM package without previously downloading it.

Note: For a more detailed guide on installing RPM packages, check out our guide on how to install RPM packages on Ubuntu.

Upgrade RPM Packages

RPM upgrades a package by uninstalling the current version and installing the latest one.

The command for upgrading a package is:

sudo rpm -Uvh package_name
  • -U (upgrade)
  • -v (verbose mode)
  • -h (print hash marks to show upgrading process)
sudo rpm -Uvh mysql80-community-release-el7-5.noarch.rpm

Upgrade RPM package.

If the new version requires additional dependencies, you must install them manually. RPM lists the missing dependencies in the output after running the command.

Читайте также:  Драйвера canon lbp 2900 linux mint

To ignore the message and update without the dependencies, add the —nodeps option to the command:

sudo rpm -Uvh --nodeps package_name

Remove RPM Packages

Remove RPM packages using the -e ( —erase ) option:

To see the verbose output, add the -v option to the command:

To delete an RPM package without removing dependencies, add —nodeps :

sudo rpm -ev --nodeps package_name

For example, to remove MySQL without removing its dependencies, you run:

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

Delete an RPM package without removing its dependencies.

Note: For a more detailed guide on removing RPM packages, check out our guide on how to remove packages in CentOS.

Display Package Information After Installing

To see available information about an installed RPM package, use the -qi option, which instructs RPM to query info :

The output displays the installed information, package version, and a short description.

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

Display package information after installing.

Display Package Information Before Installing

The command for displaying information about a package prior to installation is:

sudo rpm -qip package_name

The command includes the options:

To display information before installing the MySQL package, use the command:

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

Check Package Dependencies Before Installing

RPM allows you to check the dependencies of packages prior to installing them on the system. Bear in mind, you need to have the RPM package downloaded locally to see a list of dependencies.

The command for doing so is:

For example, to list the dependencies for installing the MySQL RPM package, you run:

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

Verify Packages

Verifying packages means comparing metadata from the RPM database with the information from the installed files.

You can verify all installed packages using the command:

To verify a specific package run:

Verify the installed MySQL package with:

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

Verify RPM package.

Find Manual Pages

To list available documentation related to an installed RPM package, use the -qdf option:

sudo rpm -qdf package_name

To find manual pages for MySQL, use the command:

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

List available documentation related to an installed RPM package.

List All Files of an Installed Package

See detailed information about a package by listing all its files, use the -ql option and instructs RPM to query list :

For example, to list files of the sample MySQL package, you run:

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

List all files of an installed RPM package.

List Installed Packages

List all of the installed RPM packages on the system by running the following:

The command includes the -qa option, which instructs RPM to query all.

List Recently Installed Packages

To display a list of all the recently installed packages, use the -qa (query all) option along with the —last attribute:

The output lists all the installed RPM packages, ordering them by the latest package on top.

Where to Find and Download RPM Packages?

You can find and download RPM packages on the following websites:

In this article, you learned how to use the rpm command for installing, verifying, upgrading, and deleting packages. Still, it is recommended to use the yum or dnf command for such actions as they automatically deal with dependencies.

Источник

Оцените статью
Adblock
detector