Linux

安裝前查詢包中的依賴和腳本 |CentOS 9

  • September 6, 2022

如果我想在安裝 RPM 包之前對其進行搜尋,該怎麼做?

如果我執行 yum info bind,它會給出一個基本的概述:

[user@localhost ~]$ yum info bind
Last metadata expiration check: 0:16:53 ago on Tue 06 Sep 2022 06:07:52 PM CDT.
Available Packages
Name         : bind
Epoch        : 32
Version      : 9.16.23
Release      : 4.el9
Architecture : x86_64
Size         : 504 k
Source       : bind-9.16.23-4.el9.src.rpm
Repository   : appstream
Summary      : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server
URL          : https://www.isc.org/downloads/bind/
License      : MPLv2.0
Description  : BIND (Berkeley Internet Name Domain) is an implementation of the DNS
            : (Domain Name System) protocols. BIND includes a DNS server (named),
            : which resolves host names to IP addresses; a resolver library
            : (routines for applications to use when interfacing with DNS); and
            : tools for verifying that the DNS server is operating properly.

我們可以通過 yum install bind 來查看哪些依賴會被安裝:

[user@localhost ~]$ sudo yum install bind
Last metadata expiration check: 0:07:38 ago on Tue 06 Sep 2022 06:18:56 PM CDT.
Dependencies resolved.
==========================================================================================================================================================================================================================================================================================
Package                                                                  Architecture                                                  Version                                                                    Repository                                                        Size
==========================================================================================================================================================================================================================================================================================
Installing:
bind                                                                     x86_64                                                        32:9.16.23-4.el9                                                           appstream                                                        504 k
Installing dependencies:
bind-dnssec-doc                                                          noarch                                                        32:9.16.23-4.el9                                                           appstream                                                         47 k
python3-bind                                                             noarch                                                        32:9.16.23-4.el9                                                           appstream                                                         69 k
Installing weak dependencies:
bind-dnssec-utils                                                        x86_64                                                        32:9.16.23-4.el9                                                           appstream                                                        118 k

Transaction Summary
==========================================================================================================================================================================================================================================================================================
Install  4 Packages

但是,有沒有辦法查詢哪些依賴項和腳本將通過 rpm 安裝?範例:rpm -q –scripts bind.x86_64 或 rpm -ql bind.x86_64

[user@localhost ~]$ rpm -ql bind.x86_64
package bind.x86_64 is not installed

可以yumdownloader用來戳包裝:

# yum -y install yum-utils
# yumdownloader bind
# rpm -qp --scripts bind*.rpm

為了避免必須安裝yum-utils,另一個選項可能是:

# yum --downloadonly install bind
# find /var/cache/yum -name bind\*

如果您還需要檢查依賴項,這具有降低依賴項的優勢。

引用自:https://unix.stackexchange.com/questions/716402