1-2 查询RPM软件包信息

2016.6.4


RPM=red hat package manager


一、查询已安装的RPM软件信息

1.格式:

  • rpm -q [子选项] /[软件名]


QUERYING AND VERIFYING PACKAGES:

   rpm {-q|--query} [select-options] [query-options]

   rpm {-V|--verify} [select-options] [verify-options]

   rpm --import PUBKEY ...

   rpm {-K|--checksig} [--nosignature] [--nodigest]
       PACKAGE_FILE ...

query-options

    [--changelog] [-c,--configfiles] [-d,--docfiles] [--dump]
    [--filesbypkg] [-i,--info] [--last] [-l,--list]
    [--provides] [--qf,--queryformat QUERYFMT]
    [-R,--requires] [--scripts] [-s,--state]
    [--triggers,--triggerscripts]

2.用法:结合不同子选项完成不同的查询

  • -qa:查看已安装的所有RPM软件包列表

  • -qi:查看指定软件的详细信息

  • -ql:查询软件包安装的目录、文件列表

rpm -qa | grep telnet

[root@test2 jason]# rpm -qa | grep telnet
telnet-server-0.17-47.el6_3.1.x86_64
telnet-0.17-47.el6_3.1.x86_64
[root@test2 jason]#

q:query

-a, --all

Query all installed packages.

-i, --info

Display package information, including name, version,  and  description.   
This uses the --queryformat if one was specified.

l=list

rpm -qi telnet

[root@test2 jason]# rpm -qi telnet
Name        : telnet                       Relocations: (not relocatable)
Version     : 0.17                              Vendor: CentOS
Release     : 47.el6_3.1                    Build Date: Wed 26 Sep 2012 04:39:23 PM CST
Install Date: Wed 25 May 2016 01:37:13 AM CST      Build Host: c6b10.bsys.dev.centos.org
Group       : Applications/Internet         Source RPM: telnet-0.17-47.el6_3.1.src.rpm
Size        : 112016                           License: BSD
Signature   : RSA/SHA1, Wed 26 Sep 2012 09:16:04 PM CST, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Summary     : The client program for the Telnet remote login protocol
Description :
Telnet is a popular protocol for logging into remote systems over the
Internet. The package provides a command line Telnet client
[root@test2 jason]#

rpm -ql telnet

[root@test2 jason]# rpm -ql telnet
/usr/bin/telnet
/usr/share/man/man1/telnet.1.gz




二、查询文件或目录属于哪个RPM软件

1.格式:

  • rpm -qf 文件或目录名

-f, --file FILE

Query package owning FILE.


rpm -qf /usr/bin/passwd

rpm -qf /usr/bin/vim
[root@test2 jason]# rpm -qf /usr/bin/passwd
passwd-0.77-4.el6_2.2.x86_64
[root@test2 jason]#




查询未安装的RPM包文件

1.格式

  • rpm -qp[子选项] RPM包文件

-p, --package PACKAGE_FILE

          Query an (uninstalled) package PACKAGE_FILE.  The PACKAGE_FILE may be specified
          as an ftp or http style URL, in which case the package  header  will  be  down-
          loaded and queried.  See FTP/HTTP OPTIONS for information on rpm’s internal ftp
          and http client support. The PACKAGE_FILE argument(s), if not a binary package,
          will  be interpreted as an ASCII package manifest unless --nomanifest option is
          used.  In manifests, comments are permitted, starting with a ’#’, and each line
          of  a package manifest file may include white space separated glob expressions,
          including URL’s, that will be expanded to paths that are substituted  in  place
          of the package manifest as additional PACKAGE_FILE arguments to the query.

2.用法:结合不同子选项完成不同的查询

  • -qpi:查看该软件的详细信息

  • -qpl:查看包内所包含的目录、文件列表

示例 rpm -qpi ethtool-3.5-1.el6.x86_64.rpm rpm -qpl ethtool-3.5-1.el6.x86_64.rpm


Dependencies Programs seldom stand alone; rather, they rely on the presence of other software components to get their work done. Common activities, such as input/output for example, are handled by routines shared by many programs. These routines are stored in what are called shared libraries, which provide essential services to more than one program. If a package requires a shared resource such as a shared library, it is said to have a dependency. Modern package management systems all provide some method of dependency resolu- tion to ensure that when a package is installed, all of its dependencies are installed, too.

High- and Low-Level Package Tools Package management systems usually consist of two types of tools: low-level tools that handle tasks such as installing and removing package files, and high-level tools that perform metadata searching and dependency resolu- tion. In this chapter, we will look at the tools supplied with Debian-style sys- tems (such as Ubuntu and many others) and those used by recent Red Hat products. While all Red Hat–style distributions rely on the same low-level program ( rpm ), they use different high-level tools. For our discussion, we will cover the high-level program yum , used by Fedora, Red Hat Enterprise Linux, and CentOS. Other Red Hat–style distributions provide high-level tools with comparable features (see Table 14-2).

Finding a Package in a Repository

Example: Search a yum repository for the emacs text editor on a Red Hat system: yum search emacs



rpm

results matching ""

    No results matching ""