如何使用 YUM 列出包的内容?
我知道如何使用 rpm 列出包的内容 (rpm -qpil package.rpm
)。 但是,这需要知道 .rpm 文件在文件系统上的位置。 一个更优雅的解决方案是使用包管理器,在我的例子中是 YUM。 如何使用 YUM 来实现这一目标?
I know how to use rpm to list the contents of a package (rpm -qpil package.rpm
). However, this requires knowing the location of the .rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How can YUM be used to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Yum 没有自己的包类型。 Yum 运营并帮助管理 RPM。 因此,您可以使用 yum 列出可用的 RPM,然后运行 rpm -qlp 命令来查看该包的内容。
Yum doesn't have it's own package type. Yum operates and helps manage RPMs. So, you can use yum to list the available RPMs and then run the rpm -qlp command to see the contents of that package.
有一个名为
yum-utils
的包,它构建在 YUM 之上,并包含一个名为repoquery
的工具,可以执行此操作。合并为一个示例:
在至少一个 RH 系统上,使用 rpm v4.8.0、yum v3.2.29 和 repoquery v0.0.11,
repoquery -l rpm
不打印任何内容。如果您遇到此问题,请尝试添加
--installed
标志:repoquery --installed -l rpm
。DNF
更新:要使用
dnf
而不是yum-utils
,请使用以下命令:There is a package called
yum-utils
that builds on YUM and contains a tool calledrepoquery
that can do this.Combined into one example:
On at least one RH system, with rpm v4.8.0, yum v3.2.29, and repoquery v0.0.11,
repoquery -l rpm
prints nothing.If you are having this issue, try adding the
--installed
flag:repoquery --installed -l rpm
.DNF
Update:To use
dnf
instead ofyum-utils
, use the following command:示例
无需安装 yum-utils,也无需知道 rpm 文件的位置。
Example
No need to install yum-utils, or to know the location of the rpm file.
我认为您无法使用 yum 列出软件包的内容,但如果您的本地系统上有 .rpm 文件(所有已安装的软件包很可能都是这种情况),您可以使用 rpm 命令列出该软件包的内容如下所示:
如果您没有软件包文件 (.rpm),但已安装该软件包,请尝试以下操作:
I don't think you can list the contents of a package using yum, but if you have the .rpm file on your local system (as will most likely be the case for all installed packages), you can use the rpm command to list the contents of that package like so:
If you don't have the package file (.rpm), but you have the package installed, try this:
目前,
reopquery
已集成到dnf
和yum
中,因此输入:将列出远程存储库中的包内容(即使是未安装的包)然而)
这意味着该功能不再需要安装单独的 dnf-utils 或 yum-utils 包,因为它现在已得到本机支持。
要列出已安装或本地(
*.rpm
文件)软件包的内容,有rpm -ql
我不'不认为可以使用
yum
orgdnf
(不是repoquery
子命令)如果我错了,请纠正我
currently
reopquery
is integrated intodnf
andyum
, so typing:will list package contents from a remote repository (even for the packages that are not installed yet)
meaning installing a separate
dnf-utils
oryum-utils
package is no longer required for the functionality as it is now being supported natively.for listing installed or local (
*.rpm
files) packages' contents there isrpm -ql
i don't think it is possible with
yum
orgdnf
(notrepoquery
subcommand)please correct me if i am wrong
这里有几个很好的答案,所以让我提供一个糟糕的答案:
There are several good answers here, so let me provide a terrible one: