如何在 Linux 上检查一个软件包的详细信息

Prakash Subramanian 的头像

·

·

·

9,172 次阅读

我们可以就这个已经被广泛讨论的话题写出大量的文章,大多数情况下,因为各种各样的原因,我们都愿意让 包管理器 package manager 来帮我们做这些事情。

每个 Linux 发行版都有自己的包管理器,并且每个都有各自有不同的特性,这些特性包括允许用户执行安装新软件包,删除无用的软件包,更新现存的软件包,搜索某些具体的软件包,以及更新整个系统到其最新的状态之类的操作。

习惯于命令行的用户大多数时间都会使用基于命令行方式的包管理器。对于 Linux 而言,这些基于命令行的包管理器有 yumdnfrpmaptapt-getdpkgpacmanzypper

推荐阅读

作为一个系统管理员你应该清楚地知道:安装包来自何方,具体来自哪个软件仓库,包的具体版本,包的大小,版本,包的源代码 URL,包的许可证信息,等等。

这篇短文将用尽可能简单的方式帮你从随包自带的总结和描述中了解该包的用法。按你所使用的 Linux 发行版的不同,运行下面相应的命令,你能得到你所使用的发行版下的包的详细信息。

YUM 命令:在 RHEL 和 CentOS 系统上获得包的信息

YUM 英文直译是“ 黄狗更新器–修改版 Yellowdog Updater, Modified ”,它是一个开源的基于命令行的包管理器前端实用工具。它被广泛应用在基于 RPM 的系统上,例如:RHEL 和 CentOS。

Yum 是用于在官方发行版仓库以及其他第三方发行版仓库下获取、安装、删除、查询 RPM 包的主要工具。

(LCTT 译注:用 yum info 获取 python 包的信息)

# yum info python
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * epel: epel.mirror.constant.com
Installed Packages
Name        : python
Arch        : x86_64
Version     : 2.6.6
Release     : 66.el6_8
Size        : 78 k
Repo        : installed
From repo   : updates
Summary     : An interpreted, interactive, object-oriented programming language
URL         : http://www.python.org/
License     : Python
Description : Python is an interpreted, interactive, object-oriented programming
            : language often compared to Tcl, Perl, Scheme or Java. Python includes
            : modules, classes, exceptions, very high level dynamic data types and
            : dynamic typing. Python supports interfaces to many system calls and
            : libraries, as well as to various windowing systems (X11, Motif, Tk,
            : Mac and MFC).
            :
            : Programmers can write new built-in modules for Python in C or C++.
            : Python can be used as an extension language for applications that need
            : a programmable interface.
            :
            : Note that documentation for Python is provided in the python-docs
            : package.
            :
            : This package provides the "python" executable; most of the actual
            : implementation is within the "python-libs" package.

YUMDB 命令:查看 RHEL 和 CentOS 系统上的包信息

yumdb info 这个命令提供与 yum info 相类似的的信息,不过它还额外提供了诸如包校验值、包类型、用户信息(由何人安装)。从 yum 3.2.26 版本后,yum 开始在 rpm 数据库外储存额外的信息了(此处如显示 user 表明该包由用户安装,而 dep 说明该包是被作为被依赖的包而被安装的)。

(LCTT 译注:用 yumdb info 来获取 python 包的信息)

# yumdb info python
Loaded plugins: fastestmirror
python-2.6.6-66.el6_8.x86_64
     changed_by = 4294967295
     checksum_data = 53c75a1756e5b4f6564c5229a37948c9b4561e0bf58076bd7dab7aff85a417f2
     checksum_type = sha256
     command_line = update -y
     from_repo = updates
     from_repo_revision = 1488370672
     from_repo_timestamp = 1488371100
     installed_by = 4294967295
     reason = dep
     releasever = 6

RPM 命令:在 RHEL/CentOS/Fedora 系统上查看包的信息

RPM 英文直译为“ 红帽包管理器 Red Hat Package Manager ”,这是一个在 RedHat 以及其变种发行版(如RHEL、CentOS、Fedora、openSUSE、Megeia)下的功能强大的命令行包管理工具。它能让你轻松的安装、升级、删除、查询以及校验你的系统或服务器上的软件。RPM 文件以 .rpm 结尾。RPM 包由它所依赖的软件库以及其他依赖构成,它不会与系统上已经安装的包冲突。

(LCTT 译注:用 rpm -qi 查询 nano 包的具体信息)

# rpm -qi nano
Name        : nano                         Relocations: (not relocatable)
Version     : 2.0.9                             Vendor: CentOS
Release     : 7.el6                         Build Date: Fri 12 Nov 2010 02:18:36 AM EST
Install Date: Fri 03 Mar 2017 08:57:47 AM EST      Build Host: c5b2.bsys.dev.centos.org
Group       : Applications/Editors          Source RPM: nano-2.0.9-7.el6.src.rpm
Size        : 1588347                          License: GPLv3+
Signature   : RSA/8, Sun 03 Jul 2011 12:46:50 AM EDT, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem 
URL         : http://www.nano-editor.org
Summary     : A small text editor
Description :
GNU nano is a small and friendly text editor.

DNF 命令:在 Fedora 系统上查看包信息

DNF 指“ 时髦版的 Yum Dandified yum ”,我们也可以认为 DNF 是下一代的 yum 包管理器(Yum 的一个分支),它在后台使用了 hawkey/libsolv 库。Aleš Kozumplík 在Fedora 18 上开始开发 DNF,在 Fedora 22 上正式最后发布。 dnf 命令用来在 Fedora 22 及以后的系统上安装、更新、搜索以及删除包。它能自动的解决包安装过程中的包依赖问题。

(LCTT 译注: 用 dnf info 查看 tilix 包信息)

$ dnf info tilix
Last metadata expiration check: 27 days, 10:00:23 ago on Wed 04 Oct 2017 06:43:27 AM IST.
Installed Packages
Name         : tilix
Version      : 1.6.4
Release      : 1.fc26
Arch         : x86_64
Size         : 3.6 M
Source       : tilix-1.6.4-1.fc26.src.rpm
Repo         : @System
From repo    : @commandline
Summary      : Tiling terminal emulator
URL          : https://github.com/gnunn1/tilix
License      : MPLv2.0 and GPLv3+ and CC-BY-SA
Description  : Tilix is a tiling terminal emulator with the following features:
             : 
             :  - Layout terminals in any fashion by splitting them horizontally or vertically
             :  - Terminals can be re-arranged using drag and drop both within and between
             :    windows
             :  - Terminals can be detached into a new window via drag and drop
             :  - Input can be synchronized between terminals so commands typed in one
             :    terminal are replicated to the others
             :  - The grouping of terminals can be saved and loaded from disk
             :  - Terminals support custom titles
             :  - Color schemes are stored in files and custom color schemes can be created by
             :    simply creating a new file
             :  - Transparent background
             :  - Supports notifications when processes are completed out of view
             : 
             : The application was written using GTK 3 and an effort was made to conform to
             : GNOME Human Interface Guidelines (HIG).

Zypper 命令:在 openSUSE 系统上查看包信息

zypper 是一个使用 libzypp 库的命令行包管理器。zypper 提供诸如软件仓库访问,安装依赖解决,软件包安装等等功能。

(LCTT 译注: 用 zypper info 查询 nano 包的信息)


$ zypper info nano

Loading repository data...
Reading installed packages...

Information for package nano:

via: <https://www.2daygeek.com/how-to-view-detailed-information-about-a-package-in-linux/>

作者:[Prakash Subramanian](https://www.2daygeek.com/author/prakash/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[DavidChenLiang](https://github.com/davidchenliang) 校对:[wxy](https://github.com/wxy)

本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注