• 推荐
  • 评论
  • 收藏

yum 显示、搜索和列出软件包信息 - Yum命令大全

2020-08-28    7464次浏览

使用yum搜索相关软件包信息

使用 yum search <term> [more_terms] 命令,能够在已启用的软件包仓库中,对所有软件包的名称、描述和概述中进行搜索,最后 yum 会以显示符合合条件的搜索结果列表。如果你不记得软件包的确切名称,但了解软件包的某些相关名词时,yum search 命令能够有效地帮助你找到想要的软件包。
yum search firewalld # 搜索firewalld相关的软件包
[root@izj6c5d84aus1k307cz62iz ~]# yum search firewalld
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
=========================================================================================================== N/S matched: firewalld ===========================================================================================================
fail2ban-firewalld.noarch : Firewalld support for Fail2Ban
firewalld-filesystem.noarch : Firewalld directory layout and rpm macros
fts-monitoring-firewalld.noarch : FTS3 Web Application Firewalld
fts-rest-firewalld.noarch : FTS3 Rest Firewalld
puppet-firewalld.noarch : A Puppet module for FirewallD
firewalld.noarch : A firewall daemon with D-Bus interface providing a dynamic firewall
python-firewall.noarch : Python2 bindings for firewalld

  Name and summary matches only, use "search all" for everything.

使用yum显示和列出相关软件包列表

yum list 以及相关的一些命令则能够为你提供有关软件包、软件包集和软件仓库的信息。所有的 yum list 命令都能够使用 glob 表达式作为参数,对输出结果进行过滤。在 glob 表达式中,你可以使用 * 代表任何数量个字符,使用 ? 代表任何一个字符。通过后面的示例,你可以对 glob 表达式有些简单的认识。
  • yum list <glob_expr> [more_glob_exprs] ── 列出所有符合 glob 表达式的软件包,如:yum list 表示列出系统中所有已经安装和可以安装的程序包(这些列表里面的包的来源就是/etc/yum.repo.d、base、docker-ce-stable、epel/x86_64/metalink、epel、extras、rpmforge、updates)
  • yum list all ── 列出所有已安装的和可用的软件包
  • yum list installed ── 列出所有已经安装在系统中的软件包。输出结果的最右边一列是取得该软件包的软件仓库。标识为 installed 的软件包则说明它是做为系统基本组件而预安装的。
  • yum list available ── 列出所有启用的软件仓库中可用的软件包
  • yum grouplist ── 列出所有软件包组
  • yum repolist ── 列出所有启用的软件仓库的 ID,名称 及其包含的软件包的数量

使用yum查看具体软件包的信息

使用 yum info <package_name> [more_names] 命令可查看一个或多个软件包的信息 (此处同样可以应用 glob 表达式)。yum info <package_name> 与 rpm -q --info <package_name> 命令十分相似, 不过 yum 还能够提供软件包的软件仓库来源信息 (即输出结果中的 From repo 行)。
yum info firewalld # 显示安装包firewalld的详细信息
[root@izj6c5d84aus1k307cz62iz ~]# yum info firewalld
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
Installed Packages
Name        : firewalld
Arch        : noarch
Version     : 0.4.3.2
Release     : 8.1.el7_3.3
Size        : 1.7 M
Repo        : installed
From repo   : updates
Summary     : A firewall daemon with D-Bus interface providing a dynamic firewall
URL         : http://www.firewalld.org
License     : GPLv2+
Description : firewalld is a firewall service daemon that provides a dynamic customizable
            : firewall with a D-Bus interface.

Available Packages
Name        : firewalld
Arch        : noarch
Version     : 0.6.3
Release     : 8.el7_8.1
Size        : 443 k
Repo        : updates/7/x86_64
Summary     : A firewall daemon with D-Bus interface providing a dynamic firewall
URL         : http://www.firewalld.org
License     : GPLv2+
Description : firewalld is a firewall service daemon that provides a dynamic customizable
            : firewall with a D-Bus interface.