如何准确检查yum中是否安装了软件包?

che*_*sum 74 package-management yum rpm

我不断收到以下答案:

yum list installed | grep bind
Run Code Online (Sandbox Code Playgroud)

或者

rpm -qa | grep bind
Run Code Online (Sandbox Code Playgroud)

但这并不准确,因为我得到了一些其他像这样的绑定包的列表:

bind-utils-9.8.2-0.17.rc1.el6_4.5.x86_64
rpcbind-0.2.0-11.el6.x86_64
bind-libs-9.8.2-0.17.rc1.el6_4.5.x86_64
samba-winbind-3.6.9-151.el6.x86_64
samba-winbind-clients-3.6.9-151.el6.x86_64
ypbind-1.20.4-30.el6.x86_64
Run Code Online (Sandbox Code Playgroud)

那不是我想要的。相反,我想准确检查是否已安装绑定核心包。例如。bind.x86_64 32:9.8.2-0.17.rc1.el6_4.6

我希望是这样的:

yum check installed bind
Run Code Online (Sandbox Code Playgroud)

但希望有人可以照亮。

pla*_*d87 77

你试过这个吗?

$ yum list installed bind
Run Code Online (Sandbox Code Playgroud)

  • @NoahSussman 您可以尝试使用`yum -C list installed bind` 来避免网络连接。这会保持所有插件处于启用状态(以防万一您有任何影响 yumdb 中查找的异国情调),并且还会告诉您安装软件包的存储库 (2认同)

Joh*_*ohn 20

发出此查询的方法要简单得多:rpm -qa | grep bindrpm -q bind。如果您不完全确定包名称,则前者是最好的。

  • +1 for `rpm -q $package` 我相信这是最快的解决方案,因为使用 `yum` 做任何事情都可能会强制更新缓存(通常很慢)。 (7认同)

Fre*_*Dog 11

解析这个命令的结果是最完整的答案。您需要知道确切的包名称。

yum info bind

Loaded plugins: refresh-packagekit, rhnplugin
This system is receiving updates from RHN Classic or RHN Satellite.
Installed Packages
Name        : bind
Arch        : x86_64
Epoch       : 32
Version     : 9.8.2
Release     : 0.17.rc1.el6_4.6
Size        : 7.3 M
Repo        : installed
From repo   : rhel-x86_64-workstation-6
Summary     : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server
URL         : http://www.isc.org/products/BIND/
License     : ISC
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.
Run Code Online (Sandbox Code Playgroud)

  • 嗯,这不是告诉我 `bind` 可用/有效 yum 包而不是告诉我它是否已安装? (2认同)
  • 这并不明显,但如果已安装在 Repo 标签下列出,则表示已安装。否则它会列出它可用的回购。 (2认同)