Support > About independent server > Useful RPM package management commands in Linux
Useful RPM package management commands in Linux
Time : 2024-11-26 14:48:04
Edit : Jtti

RPM in Linux is a package management tool that provides a variety of commands to install, delete, query, update, and verify. Common RPM management commands and detailed instructions to share with you.

RPM package installation:

sudo rpm -i <package_name>.rpm

Where i is the RPM package to be installed, and <package_name>.rpm is the rpm package file to be installed. For example, to install example.rpm:

sudo rpm -i example.rpm

To upgrade the RPM package, you can use the u option:

sudo rpm -U <package_name>.rpm

u refers to the upgrade of the specified RPM package, if the package is already installed rpm upgrades it, if not, rpm installs it as a new package. Upgrade the example.rpm package:

sudo rpm -U example.rpm

To uninstall/delete the RPM package, use the e option:

sudo rpm -e <package_name>

Where e is the specified package to be deleted and <package_name> is the name of the package to be deleted.

Uninstall the example program:

sudo rpm -e example

If you want to know all the installed packages, you can use q to list them:

rpm -qa

q indicates query mode, and a lists all installed packages.

If you want to check whether a specific package is installed, you can specify the package name:

rpm -q <package_name>

To check whether the curl package has been installed, run the following command:

rpm -q curl

If you want to see the details of the installed packages, you can use qi:

rpm -qi <package_name>

i Displays package details. To view details about the curl package:

rpm -qi curl

If you want to see all the files installed in a package:

rpm -ql <package_name>

1 is all the files installed by the specified package. To view the curl package installed files:

rpm -ql curl

If you know the file path and want to know which package installed the file, you can use the qf query:

rpm -qf <file_path>

f indicates to query which package the file belongs to. To verify the signature of an installed package and ensure that it has not been tampered with, you can use the k option:

rpm -K <package_name>.rpm

If so, take care of any lost or damaged documents:

rpm -V <package_name>

Query package dependencies:

rpm -qR <package_name>

Find out which packages depend on a given package:

rpm -q --whatrequires <package_name>

whatrequires is to display which packages depend on the specified package. To view the installation path of the package:

rpm -q --queryformat '%{INSTALLTIME:date}\n' <package_name>

%{INSTALLTIME:date} is the installation time of the display package.

Get the metadata of the RPM package file, such as version, size, build time, etc. :

rpm -qpi <package_name>.rpm

p is the package file for the specified operation. i is to display package details.

To create an RPM package in RHEL or CentOS, install the following tools:

sudo yum install rpmdevtools

Create a new RPM package:

rpmdev-setuptree

RPM is a very powerful warranty technology with which it can easily install, uninstall, query, verify and manage globally.

Relevant contents

Quick Linux Method of viewing installed software packages Common operations on Linux disk partitioning tool Parted What is the network resilience of Hong Kong servers and how to maintain it Useful tool for monitoring CPU and GPU temperature in Ubuntu Method of using dtrx command in Linux Start, stop, and restart service commands in Linux Common ways to find disk space directories and files in Linux A tool for monitoring data transfers in Linux An effective way to track wasted disk space in Linux Use the nc and pv commands to transfer files between the two servers
Go back

24/7/365 support.We work when you work

Support