亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

目錄
RPM Facts
Basic Modes for RPM Command
Where to Find RPM Packages
1. How to Check RPM Package Signature
2. How to Install RPM Package
3. How to Check Dependencies of RPM Package Before Installing
4. How to Install RPM Package Without Dependencies
5. How to Check Installed RPM Package
6. How to Find Where RPM Files are Installed
7. How to List Recently Installed RPM Packages
8. How to List All Installed RPM Packages
9. How to Upgrade a RPM Package
10. How to Remove a RPM Package
11. How to Remove an RPM Package Without Dependencies
12. How to Find RPM Package of a Specific File
13. How to Query Information of Installed RPM Package
14. Get the Information of RPM Package Before Installing
15. How to Query Documentation of Installed RPM Package
16. How to Verify a RPM Package
17. How to Verify all RPM Packages
18. How to Import an RPM GPG Key
19. How to List all Imported RPM GPG Keys
20. How To Rebuild Corrupted RPM Database
首頁 系統(tǒng)教程 Linux Linux軟件包管理20 rpm命令

Linux軟件包管理20 rpm命令

May 24, 2025 am 10:39 AM

20 RPM Commands for Linux Package Management

RPM (Red Hat Package Manager) is a default open-source and widely-used package management utility for Red Hat-based systems such as CentOS Fedora, Rocky, and Alma Linux.

The rpm package management tool enables system administrators and users to install, update, uninstall, query, verify, and manage software packages on Unix/Linux operating systems, which formerly known as a .rpm file, contains compiled software programs and libraries required by the packages.

This article provides 20 useful examples of RPM commands that might be helpful to you. With the help of these RPM commands, you can manage the installation, updating, and removal of packages on your Linux systems.

RPM Facts

Here are some facts about RPM (Red Hat Package Manager):

  • RPM is freely available and released under the General Public License (GPL).
  • RPM maintains a database of all installed packages, storing this information in the /var/lib/rpm directory.
  • RPM serves as the primary method for installing packages on Linux systems. If packages have been installed using source code, RPM does not manage them.
  • RPM operates with .rpm files, containing vital package information such as its identity, source, dependencies, version details, and more.

Basic Modes for RPM Command

Here are the primary modes for the RPM command:

  • Install – The rpm -i command installs a new package on the system.
  • Upgrade – The rpm -U command upgrades an existing package to a newer version.
  • Remove – The rpm -e command uninstalls or removes a package from the system.
  • Query – The rpm -q command queries the RPM database for information about installed packages.
  • Verify – The rpm -V command verifies the integrity of installed package files.
  • Freshen – The rpm -F command upgrades or installs a package only if it is already installed.
  • Rebuild Database – The rpm --rebuilddb command rebuilds the RPM database, resolving database corruption issues.
  • Import GPG Key – The rpm --import command imports a GPG key used for package signature verification.
  • Query All – The rpm -qa command lists all installed packages on the system.
  • Query Files – The rpm -ql command lists all files installed by a specific package.
  • Query Documentation – The rpm -qd command lists documentation files provided by a package.
  • Query Dependencies – The rpm -qR command lists runtime dependencies for a package.
  • Query Provides – The rpm -q --provides command lists capabilities provided by a package.
  • Query Requires – The rpm -q --requires command lists dependencies required by a package.

Where to Find RPM Packages

You can find RPM packages in several places, depending on your Linux distribution. Here are common locations where you can find and download all RPM packages.

  • http://rpmfind.net
  • http://www.redhat.com
  • https://pkgs.org/
  • http://rpm.pbone.net/

Please remember you must be a root user when installing packages in Linux, with the root privileges you can manage rpm commands with their appropriate options.

1. How to Check RPM Package Signature

Always check the PGP signature of packages before installing them on your Linux systems and make sure their integrity and origin are OK.

Use the following command with --checksig (check signature) option to check the signature of a package called hardinfo.

<strong>rpm --checksig hardinfo-2.0.11-FedoraLinux-39.x86_64.rpm</strong>

hardinfo-2.0.11-FedoraLinux-39.x86_64.rpm: digests OK

2. How to Install RPM Package

To install an RPM software package, use the following command with -ivh option, which will install the rpm package called hardinfo-2.0.11-FedoraLinux-39.x86_64.rpm on a Linux system.

<strong>rpm -ivh hardinfo-2.0.11-FedoraLinux-39.x86_64.rpm</strong>

Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:hardinfo-2.0.11-1                ################################# [100%]

Let’s break down the components of the above command:

  • -i : install a package
  • -v : verbose for a nicer display
  • -h: print hash marks (#) to show the progress of the installation.

3. How to Check Dependencies of RPM Package Before Installing

Let’s say you would like to do a dependency check before installing or upgrading a package. For example, use the following command to check the dependencies of hardinfo-2.0.11-FedoraLinux-39.x86_64.rpm package.

The command queries and displays the runtime dependencies required by the “hardinfo” package, which helps to identify and ensure that all necessary dependencies are met before installing the package.

<strong>rpm -qpR hardinfo-2.0.11-FedoraLinux-39.x86_64.rpm</strong>
 
libX11.so.6()(64bit)
libatk-1.0.so.0()(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.33)(64bit)
libc.so.6(GLIBC_2.34)(64bit)
libc.so.6(GLIBC_2.38)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
libcairo-gobject.so.2()(64bit)
libcairo.so.2()(64bit)
...

Let’s break down the components of the above command:

  • -q : Query a package.
  • -p : List capabilities this package provides.
  • -R : List capabilities on which this package depends.

4. How to Install RPM Package Without Dependencies

To install an rpm package without dependencies, you can use --nodeps option, which will forcefully install an RPM package without checking or resolving dependencies.

rpm -ivh --nodeps hardinfo-2.0.11-FedoraLinux-39.x86_64.rpm

The above command forcefully installs the rpm package by ignoring dependencies errors, but if those dependency files are missing, then the program will not work at all until you install them.

5. How to Check Installed RPM Package

To check an installed rpm package, you can use -q option, which will query and display information about the installed version of the package.

<strong>rpm -q hardinfo</strong>

hardinfo-2.0.11-1.x86_64

6. How to Find Where RPM Files are Installed

To view all the files of an installed rpm package, use the -ql (query list) with rpm command.

<strong>rpm -ql hardinfo</strong>

/usr/bin/hardinfo2
/usr/lib/.build-id
/usr/lib/.build-id/3a
/usr/lib/.build-id/53
/usr/lib/.build-id/7c
/usr/lib/.build-id/ba
/usr/lib/.build-id/e0
/usr/lib64/hardinfo2
/usr/lib64/hardinfo2/modules
/usr/lib64/hardinfo2/modules/benchmark.so
/usr/lib64/hardinfo2/modules/computer.so
/usr/lib64/hardinfo2/modules/devices.so
/usr/lib64/hardinfo2/modules/network.so
...

7. How to List Recently Installed RPM Packages

Use the following rpm command with -qa (query all) option, will list all the recently installed rpm packages.

<strong>rpm -qa --last</strong>


hardinfo-2.0.11-1.x86_64                      Mon 04 Mar 2024 01:32:14 PM IST
pipewire-pulseaudio-1.0.3-1.fc39.x86_64       Mon 04 Mar 2024 01:32:02 PM IST
pipewire-jack-audio-connection-kit-1.0.3-1.fc39.x86_64 Mon 04 Mar 2024 01:32:02 PM IST
pipewire-alsa-1.0.3-1.fc39.x86_64             Mon 04 Mar 2024 01:32:02 PM IST
libsoup-devel-2.74.3-3.fc39.x86_64            Mon 04 Mar 2024 01:32:02 PM IST
json-glib-devel-1.8.0-1.fc39.x86_64           Mon 04 Mar 2024 01:32:02 PM IST
gtk3-devel-3.24.41-1.fc39.x86_64              Mon 04 Mar 2024 01:32:02 PM IST
xdg-desktop-portal-gtk-1.15.1-1.fc39.x86_64   Mon 04 Mar 2024 01:32:01 PM IST
xdg-desktop-portal-1.18.2-1.fc39.x86_64       Mon 04 Mar 2024 01:32:01 PM IST
libcanberra-gtk3-0.30-32.fc39.x86_64          Mon 04 Mar 2024 01:32:01 PM IST
gtk3-3.24.41-1.fc39.x86_64                    Mon 04 Mar 2024 01:32:01 PM IST
...

8. How to List All Installed RPM Packages

Type the following command to print all the names of installed packages on your Linux system.

<strong>rpm -qa</strong>

fonts-filesystem-2.0.5-12.fc39.noarch
libreport-filesystem-2.17.11-3.fc39.noarch
hunspell-filesystem-1.7.2-5.fc39.x86_64
abattis-cantarell-vf-fonts-0.301-10.fc39.noarch
fedora-gpg-keys-39-1.noarch
fedora-repos-39-1.noarch
setup-2.14.4-1.fc39.noarch
filesystem-3.18-6.fc39.x86_64
basesystem-11-18.fc39.noarch
default-fonts-core-sans-4.0-9.fc39.noarch
langpacks-fonts-en-4.0-9.fc39.noarch
...

9. How to Upgrade a RPM Package

If we want to upgrade any RPM package “–U” (upgrade) option will be used. One of the major advantages of using this option is that it will not only upgrade the latest version of any package, but it will also maintain the backup of the older package so that in case if the newer upgraded package does not run the previously installed package can be used again.

rpm -Uvh hardinfo-2.0.11-FedoraLinux-39.x86_64.rpm

10. How to Remove a RPM Package

To un-install an RPM package, for example, we use the package name hardinfo, not the original package name hardinfo-2.0.11-FedoraLinux-39.x86_64.rpm. The -e (erase) option is used to remove the package.

rpm -evv hardinfo

11. How to Remove an RPM Package Without Dependencies

The --nodeps (do not check dependencies) option forcefully remove the rpm package from the system. But keep in mind removing a particular package may break other working applications.

rpm -ev --nodeps hardinfo

12. How to Find RPM Package of a Specific File

Let’s say, you have a list of files and you would like to find out which package belongs to these files. For example, the following command with -qf (query file) option will show you a file /usr/bin/htpasswd that is owned by package httpd-tools-2.4.58-1.fc39.x86_64.

rpm -qf /usr/bin/htpasswd

httpd-tools-2.4.58-1.fc39.x86_64

13. How to Query Information of Installed RPM Package

Let’s say you have installed an rpm package and want to know the information about the package. The following -qi (query info) option will print the available information of the installed package.

<strong>rpm -qi hardinfo</strong>

Name        : hardinfo
Version     : 2.0.11
Release     : 1
Architecture: x86_64
Install Date: Mon 04 Mar 2024 01:32:14 PM IST
Group       : unknown
Size        : 5174404
License     : GPL2+
Signature   : (none)
Source RPM  : hardinfo-2.0.11-1.src.rpm
Build Date  : Sat 02 Mar 2024 06:37:42 AM IST
Build Host  : fedora.bigbear.dk
Relocations : /usr 
Vendor      : Humanity
URL         : https://www.hardinfo2.org
Summary     : hardinfo2 built using CMake
Description :
Hardinfo2 is a small application that displays information about your hardware and operating system.  It has online benchmarking to check your machine performance against other machines.

14. Get the Information of RPM Package Before Installing

You have downloaded a package from the internet and want to know the information of a package before installing. For example, the following option -qip (query info package) will print the information of a package sqlbuddy.

<strong>rpm -qip sqlbuddy</strong>

Name        : sqlbuddy                     Relocations: (not relocatable)
Version     : 1.3.3                        Vendor: (none)
Release     : 1                            Build Date: Wed 02 Nov 2011 11:01:21 PM BDT
Install Date: (not installed)              Build Host: rpm.bar.baz
Group       : Applications/Internet        Source RPM: sqlbuddy-1.3.3-1.src.rpm
Size        : 1155804                      License: MIT
Signature   : (none)
Packager    : Erik M Jacobs
URL         : http://www.sqlbuddy.com/
Summary     : SQL Buddy a Web based MySQL administration
Description : SQLBuddy is a PHP script that allows for web-based MySQL administration.

15. How to Query Documentation of Installed RPM Package

To get the list of available documentation of an installed package, use the following command with the option -qdf (query document file) will display the manual pages related to the vmstat package.

<strong>rpm -qdf /usr/bin/vmstat</strong>

/usr/share/doc/procps-ng/AUTHORS
/usr/share/doc/procps-ng/FAQ
/usr/share/doc/procps-ng/NEWS
/usr/share/doc/procps-ng/README.md
/usr/share/doc/procps-ng/bugs.md
/usr/share/man/man1/free.1.gz
/usr/share/man/man1/pgrep.1.gz
...

16. How to Verify a RPM Package

Verifying a package compares the information of installed files of the package against the rpm database. The -Vp (verify package) is used to verify a package.

rpm -Vp sqlbuddy-1.3.3-1.noarch.rpm

S.5....T.  c /etc/httpd/conf.d/sqlbuddy.conf

17. How to Verify all RPM Packages

Type the following command to verify all the installed rpm packages.

<strong>rpm -Va</strong>

S.5....T.  c /etc/rc.d/rc.local
.......T.  c /etc/dnsmasq.conf
.......T.    /etc/ld.so.conf.d/kernel-2.6.32-279.5.2.el6.i686.conf
S.5....T.  c /etc/yum.conf
S.5....T.  c /etc/yum.repos.d/epel.repo

18. How to Import an RPM GPG Key

To verify RHEL/CentOS/Fedora packages, you must import the GPG key. To do so, execute the following command. It will import the CentOS 8?GPG key.

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-8

19. How to List all Imported RPM GPG Keys

To print all the imported GPG keys in your system, use the following command.

<strong>rpm -qa gpg-pubkey*</strong>

gpg-pubkey-0608b895-4bd22942
gpg-pubkey-7fac5991-4615767f
gpg-pubkey-0f2672c8-4cd950ee
gpg-pubkey-c105b9de-4e0fd3a3
gpg-pubkey-00f97f56-467e318a
gpg-pubkey-6b8d79e6-3f49313d
gpg-pubkey-849c449f-4cb9df30

20. How To Rebuild Corrupted RPM Database

Sometimes rpm database gets corrupted and stops all the functionality of rpm and other applications on the system. So, at this time we need to rebuild the rpm database and restore it with the help of the following command.

cd /var/lib
rm __db*
rpm --rebuilddb
rpmdb_verify Packages

In conclusion, the presented rpm commands provide a comprehensive guide for efficiently managing software packages on RHEL-based Linux distributions.

以上是Linux軟件包管理20 rpm命令的詳細內(nèi)容。更多資訊請關(guān)注PHP中文網(wǎng)其他相關(guān)文章!

本網(wǎng)站聲明
本文內(nèi)容由網(wǎng)友自願投稿,版權(quán)歸原作者所有。本站不承擔相應(yīng)的法律責任。如發(fā)現(xiàn)涉嫌抄襲或侵權(quán)的內(nèi)容,請聯(lián)絡(luò)admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅(qū)動的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發(fā)環(huán)境

Dreamweaver CS6

Dreamweaver CS6

視覺化網(wǎng)頁開發(fā)工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Laravel 教程
1597
29
PHP教程
1488
72
在RHEL,Rocky和Almalinux中安裝LXC(Linux容器) 在RHEL,Rocky和Almalinux中安裝LXC(Linux容器) Jul 05, 2025 am 09:25 AM

LXD被描述為下一代容器和虛擬機管理器,它為在容器內(nèi)部或虛擬機中運行的Linux系統(tǒng)提供了沉浸式的。 它為有支持的Linux分佈數(shù)量提供圖像

如何在Linux機器上解決DNS問題? 如何在Linux機器上解決DNS問題? Jul 07, 2025 am 12:35 AM

遇到DNS問題時首先要檢查/etc/resolv.conf文件,查看是否配置了正確的nameserver;其次可手動添加如8.8.8.8等公共DNS進行測試;接著使用nslookup和dig命令驗證DNS解析是否正常,若未安裝這些工具可先安裝dnsutils或bind-utils包;再檢查systemd-resolved服務(wù)狀態(tài)及其配置文件/etc/systemd/resolved.conf,並根據(jù)需要設(shè)置DNS和FallbackDNS後重啟服務(wù);最後排查網(wǎng)絡(luò)接口狀態(tài)與防火牆規(guī)則,確認53端口未

您將如何調(diào)試速度慢或使用高內(nèi)存使用量的服務(wù)器? 您將如何調(diào)試速度慢或使用高內(nèi)存使用量的服務(wù)器? Jul 06, 2025 am 12:02 AM

發(fā)現(xiàn)服務(wù)器運行緩慢或內(nèi)存佔用過高時,應(yīng)先排查原因再操作。首先要查看系統(tǒng)資源使用情況,用top、htop、free-h、iostat、ss-antp等命令檢查CPU、內(nèi)存、磁盤I/O和網(wǎng)絡(luò)連接;其次分析具體進程問題,通過ps、jstack、strace等工具追蹤高佔用進程的行為;接著檢查日誌和監(jiān)控數(shù)據(jù),查看OOM記錄、異常請求、慢查詢等線索;最後根據(jù)常見原因如內(nèi)存洩漏、連接池耗盡、緩存失效風暴、定時任務(wù)衝突進行針對性處理,優(yōu)化代碼邏輯,設(shè)置超時重試機制,加限流熔斷,並定期壓測評估資源。

在Ubuntu中安裝用於遠程Linux/Windows訪問的鱷梨調(diào)味醬 在Ubuntu中安裝用於遠程Linux/Windows訪問的鱷梨調(diào)味醬 Jul 08, 2025 am 09:58 AM

作為系統(tǒng)管理員,您可能會發(fā)現(xiàn)自己(今天或?qū)恚┰赪indows和Linux並存的環(huán)境中工作。 有些大公司更喜歡(或必須)在Windows Box上運行其一些生產(chǎn)服務(wù)已不是什麼秘密

如何使用Brasero在Linux中燃燒CD/DVD 如何使用Brasero在Linux中燃燒CD/DVD Jul 05, 2025 am 09:26 AM

坦率地說,我不記得上一次使用CD/DVD驅(qū)動器的PC。這要歸功於不斷發(fā)展的科技行業(yè),該行業(yè)已被USB驅(qū)動器和其他較小且緊湊的存儲媒體所取代,這些磁盤可提供更多存儲

如何在Linux中找到我的私人和公共IP地址? 如何在Linux中找到我的私人和公共IP地址? Jul 09, 2025 am 12:37 AM

在Linux系統(tǒng)中,1.使用ipa或hostname-I命令可查看私有IP;2.使用curlifconfig.me或curlipinfo.io/ip可獲取公網(wǎng)IP;3.桌面版可通過系統(tǒng)設(shè)置查看私有IP,瀏覽器訪問特定網(wǎng)站查看公網(wǎng)IP;4.可將常用命令設(shè)為別名以便快速調(diào)用。這些方法簡單實用,適合不同場景下的IP查看需求。

如何在Rocky Linux 8上安裝Nodejs 14/16&npm 如何在Rocky Linux 8上安裝Nodejs 14/16&npm Jul 13, 2025 am 09:09 AM

Node.js建立在Chrome的V8引擎上,是一種開源的,由事件驅(qū)動的JavaScript運行時環(huán)境,用於構(gòu)建可擴展應(yīng)用程序和後端API。 Nodejs因其非阻滯I/O模型而聞名輕巧有效,並且

如何在RHEL,Rocky和Almalinux中設(shè)置MySQL複製 如何在RHEL,Rocky和Almalinux中設(shè)置MySQL複製 Jul 05, 2025 am 09:27 AM

數(shù)據(jù)複製是將數(shù)據(jù)複製到多個服務(wù)器中以提高數(shù)據(jù)可用性並增強應(yīng)用程序的可靠性和性能的過程。在mySQL複製中,數(shù)據(jù)從主服務(wù)器的數(shù)據(jù)庫複製到OT

See all articles