如何在 RHEL 发行版中搜索并安装合适的软件包?

How to search and install the appropriate package of a software in RHEL distro?

我想知道如何找到软件包,这样我就知道用 yum 安装什么了。比如我需要使用nslookup command,我需要安装bind-utils package.

有没有办法自己找到需要安装什么包?

提前致谢!

yum whatprovides

检查 yum 的 man page

Provides Command Command: provides Aliases: prov, whatprovides, wp

   dnf [options] provides <provide-spec>
          Finds the packages providing the given <provide-spec>.
          This is useful when one knows a filename and wants to find
          what package (installed or not) provides this file.  The
          <provide-spec> is gradually looked for at following
          locations:

          1. The <provide-spec> is matched with all file provides of
             any available package:

                $ dnf provides /usr/bin/gzip
                gzip-1.9-9.fc29.x86_64 : The GNU data compression program
                Matched from:
                Filename    : /usr/bin/gzip

          2. Then all provides of all available packages are
             searched:

                $ dnf provides "gzip(x86-64)"
                gzip-1.9-9.fc29.x86_64 : The GNU data compression program
                Matched from:
                Provide     : gzip(x86-64) = 1.9-9.fc29

          3. DNF assumes that the <provide-spec> is a system
             command, prepends it with /usr/bin/, /usr/sbin/
             prefixes (one at a time) and does the file provides
             search again. For legacy reasons (packages that didn’t
             do UsrMove) also /bin and /sbin prefixes are being
             searched:

                $ dnf provides zless
                gzip-1.9-9.fc29.x86_64 : The GNU data compression program
                Matched from:
                Filename    : /usr/bin/zless

          4. If this last step also fails, DNF returns “Error: No
             Matches found”.

          This command by default does not force a sync of expired
          metadata. See also Metadata Synchronization.