2021-05-12 14:32:11
如何在 Linux 上檢查一個軟體包的詳細資訊
我們可以就這個已經被廣泛討論的話題寫出大量的文章,大多數情況下,因為各種各樣的原因,我們都願意讓包管理器package manager來幫我們做這些事情。
每個 Linux 發行版都有自己的包管理器,並且每個都有各自有不同的特性,這些特性包括允許使用者執行安裝新軟體包,刪除無用的軟體包,更新現存的軟體包,搜尋某些具體的軟體包,以及更新整個系統到其最新的狀態之類的操作。
習慣於命令列的使用者大多數時間都會使用基於命令列方式的包管理器。對於 Linux 而言,這些基於命令列的包管理器有 yum
、dnf
、rpm
、apt
、apt-get
、dpkg
、pacman
和 zypper
。
作為一個系統管理員你應該清楚地知道:安裝包來自何方,具體來自哪個軟體倉庫,包的具體版本,包的大小,版本,包的原始碼 URL,包的許可證資訊,等等。
這篇短文將用盡可能簡單的方式幫你從隨包自帶的總結和描述中了解該包的用法。按你所使用的 Linux 發行版的不同,執行下面相應的命令,你能得到你所使用的發行版下的包的詳細資訊。
YUM 命令:在 RHEL 和 CentOS 系統上獲得包的資訊
YUM 英文直譯是“黃狗更新器–修改版Yellowdog Updater, Modified”,它是一個開源的基於命令列的包管理器前端實用工具。它被廣泛應用在基於 RPM 的系統上,例如:RHEL 和 CentOS。
Yum 是用於在官方發行版倉庫以及其他第三方發行版倉庫下獲取、安裝、刪除、查詢 RPM 包的主要工具。
(LCTT 譯註:用 yum info
獲取 python 包的資訊)
#yuminfo python
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* epel: epel.mirror.constant.com
InstalledPackages
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:Pythonis an interpreted, interactive, object-oriented programming
: language often compared to Tcl,Perl,SchemeorJava.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,
:Macand MFC).
:
:Programmers can writenew built-in modules forPythonin C or C++.
:Python can be used as an extension language for applications that need
: a programmable interface.
:
:Note that documentation forPythonis provided in the python-docs
:package.
:
:Thispackage 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:nanoRelocations:(not relocatable)
Version:2.0.9Vendor:CentOS
Release:7.el6BuildDate:Fri12Nov201002:18:36 AM EST
InstallDate:Fri03Mar201708:57:47 AM EST BuildHost: c5b2.bsys.dev.centos.org
Group:Applications/EditorsSource RPM:nano-2.0.9-7.el6.src.rpm
Size:1588347License:GPLv3+
Signature: RSA/8,Sun03Jul201112:46:50 AM EDT,Key ID 0946fca2c105b9de
Packager:CentOSBuildSystem
URL : http://www.nano-editor.org
Summary: A small text editor
Description:
GNU nanois a small and friendly text editor.
DNF 命令:在 Fedora 系統上檢視包資訊
DNF 指“時髦版的 YumDandified 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 Wed04Oct201706:43:27 AM IST.
InstalledPackages
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.0andGPLv3+and CC-BY-SA
Description:Tilixis 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 newfile
:-Transparent background
:-Supports notifications when processes are completed out of view
:
:The application was written using GTK 3and an effort was made to conform to
: GNOME HumanInterfaceGuidelines(HIG).
Zypper 命令:在 openSUSE 系統上檢視包資訊
zypper 是一個使用 libzypp 庫的命令列包管理器。zypper
提供諸如軟體倉庫存取,安裝依賴解決,軟體包安裝等等功能。
(LCTT 譯註: 用 zypper info
查詢 nano 包的資訊)
$ zypper infonano
Loading repository data...
Reading installed packages...
Informationforpackagenano:
-----------------------------
Repository:MainRepository(OSS)
Name:nano
Version:2.4.2-5.3
Arch: x86_64
Vendor: openSUSE
InstalledSize:1017.8KiB
Installed:No
Status:not installed
Sourcepackage:nano-2.4.2-5.3.src
Summary:Pico editor clonewith enhancements
Description:
GNU nanois a small and friendly text editor.It aims to emulate
the Pico text editor while also offering a few enhancements.
Pacman 命令:在 ArchLinux 及 Manjaro 系統上檢視包資訊
Pacman 意即包管理器package manager實用工具。pacman
是一個用於安裝、構建、刪除、管理 Arch Linux 上包的命令列工具。它後端使用 libalpm(Arch Linux package Manager(ALPM)庫)來完成所有功能。
(LCTT 譯註: 用 pacman -Qi
來查詢 bash 包資訊)
$ pacman -Qibash
Name:bash
Version:4.4.012-2
Description:The GNU BourneAgain shell
Architecture: x86_64
URL : http://www.gnu.org/software/bash/bash.html
Licenses: GPL
Groups: base
Provides: sh
DependsOn: readline>=7.0 glibc ncurses
OptionalDeps:bash-completion:for tab completion
RequiredBy: autoconf automake bison bzip2 ca-certificates-utils db
dhcpcd diffutils e2fsprogs fakeroot figlet findutils
flex freetype2 gawk gdbm gettext gmp grub gzip icu
iptables keyutils libgpg-error libksba libpcap libpng
libtool lvm2 m4 man-db mkinitcpio nano neofetch nspr
nss openresolv os-prober pacman pcre pcre2 shadow
systemd texinfo vte-common which xdg-user-dirs xdg-utils
xfsprogs xorg-mkfontdir xorg-xpr xz
OptionalFor:None
ConflictsWith:None
Replaces:None
InstalledSize:7.13MiB
Packager:JanAlexanderSteffens(heftig)
BuildDate:Tue14Feb201701:16:51 PM UTC
InstallDate:Thu24Aug201706:08:12 AM UTC
InstallReason:Explicitly installed
InstallScript:No
ValidatedBy:Signature
apt-cache 命令:在 Debian/Ubuntu/Mint 系統上檢視包資訊
apt-cache 命令能顯示 apt 內部資料庫中的大量資訊。這些資訊是從 sources.list
中的不同的軟體源中蒐集而來,因此從某種意義上這些資訊也可以被認為是某種快取。這些資訊蒐集工作是在執行 apt update
命令時執行的。
(LCTT 譯註:用管理員許可權查詢 apache2 包的資訊)
$ sudo apt-cache show apache2
Package: apache2
Priority: optional
Section: web
Installed-Size:473
Maintainer:UbuntuDevelopers
Original-Maintainer:DebianApacheMaintainers
Architecture: amd64
Version:2.4.12-2ubuntu2
Replaces: apache2.2-common
Provides: httpd, httpd-cgi
Depends: lsb-base, procps, perl, mime-support, apache2-bin (=2.4.12-2ubuntu2), apache2-utils (>=2.4), apache2-data (=2.4.12-2ubuntu2)
Pre-Depends: dpkg (>=1.17.14)
Recommends: ssl-cert
Suggests: www-browser, apache2-doc, apache2-suexec-pristine | apache2-suexec-custom, ufw
Conflicts: apache2.2-common (<<2.3~)
Filename: pool/main/a/apache2/apache2_2.4.12-2ubuntu2_amd64.deb
Size:91348
MD5sum: ab0ee0b0d1c6b3d19bd87aa2a9537125
SHA1:350c9a1a954906088ed032aebb77de3d5bb24004
SHA256:03f515f7ebc3b67b050b06e82ebca34b5e83e34a528868498fce020bf1dbbe34
Description-en:Apache HTTP Server
TheApache HTTP ServerProject's goal is to build a secure, efficient and
extensible HTTP server as standards-compliant open source software. The
result has long been the number one web server on the Internet.
.
Installing this package results in a full installation, including the
configuration files, init scripts and support scripts.
Description-md5: d02426bc360345e5acd45367716dc35c
Homepage: http://httpd.apache.org/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 9m
Task: lamp-server, mythbuntu-frontend, mythbuntu-desktop, mythbuntu-backend-slave, mythbuntu-backend-master, mythbuntu-backend-master
APT 命令:檢視 Debian/Ubuntu/Mint 系統上的包資訊
APT 意為高階打包工具Advanced Packaging Tool,就像 DNF 將如何替代 YUM 一樣,APT 是 apt-get 的替代物。它功能豐富的命令列工具包括了如下所有命令的功能如 apt-cache
、apt-search
、dpkg
、apt-cdrom
、apt-config
、apt-key
等等,我們可以方便的通過 apt
來安裝 .dpkg
包,但是我們卻不能通過 apt-get
來完成這一點,還有一些其他的類似的功能也不能用 apt-get
來完成,所以 apt-get
因為沒有解決上述功能缺乏的原因而被 apt
所取代。
(LCTT 譯註: 用 apt show
檢視 nano 包資訊)
$ apt show nano
Package:nano
Version:2.8.6-3
Priority: standard
Section: editors
Origin:Ubuntu
Maintainer:UbuntuDevelopers
Original-Maintainer:JordiMallach
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size:766 kB
Depends: libc6 (>=2.14), libncursesw5 (>=6), libtinfo5 (>=6)
Suggests: spell
Conflicts: pico
Breaks:nano-tiny (<<2.8.6-2)
Replaces:nano-tiny (<<2.8.6-2), pico
Homepage: https://www.nano-editor.org/
Task: standard, ubuntu-touch-core, ubuntu-touch
Supported:9m
Download-Size:222 kB
APT-Manual-Installed:yes
APT-Sources: http://in.archive.ubuntu.com/ubuntu artful/main amd64 Packages
Description: small, friendly text editor inspired by Pico
GNU nanois an easy-to-use text editor originally designed as a replacement
forPico, the ncurses-based editor from the non-free mailer packagePine
(itself now available under the ApacheLicenseasAlpine).
.
However, GNU nano also implements many features missing in pico, including:
- undo/redo
- line numbering
- syntax coloring
- soft-wrapping of overlong lines
- selecting text by holding Shift
- interactive search and replace (with regular expression support)
- a go-to line (and column) command
- support for multiple file buffers
-auto-indentation
- tab completion of filenames and search terms
- toggling features while running
-and full internationalization support
dpkg 命令:檢視Debian/Ubuntu/Mint系統上的包資訊
dpkg 意指 Debian 包管理器Debian package manager。dpkg
是用於 Debian 系統上安裝、構建、移除以及管理 Debian 包的命令列工具。dpkg
使用 aptitude
(因為它更為主流及使用者友好)作為前端工具來完成所有的功能。其他的工具如dpkg-deb
和 dpkg-query
使用 dpkg
做為前端來實現功能。儘管系統管理員還是時不時會在必要時使用 dpkg
來完成一些軟體安裝的任務,他大多數情況下還是會因為 apt
、apt-get
以及 aptitude
的健壯性而使用後者。
(LCTT 譯註: 用 dpkg -s
檢視 python 包的資訊)
$ dpkg -s python
Package: python
Status: install ok installed
Priority: optional
Section: python
Installed-Size:626
Maintainer:UbuntuDevelopers
Architecture: amd64
Multi-Arch: allowed
Source: python-defaults
Version:2.7.14-2ubuntu1
Replaces: python-dev (<<2.6.5-2)
Provides: python-ctypes, python-email, python-importlib, python-profiler, python-wsgiref
Depends: python2.7(>=2.7.14-1~), libpython-stdlib (=2.7.14-2ubuntu1)
Pre-Depends: python-minimal (=2.7.14-2ubuntu1)
Suggests: python-doc (=2.7.14-2ubuntu1), python-tk (>=2.7.14-1~)
Breaks: update-manager-core (<<0.200.5-2)
Conflicts: python-central (<<0.5.5)
Description: interactive high-level object-oriented language (default version)
Python, the high-level, interactive object oriented language,
includes an extensive class library with lots of goodies for
network programming, system administration, sounds and graphics.
.
Thispackageis a dependency package, which depends on Debian's default
Python version (currently v2.7).
Homepage: http://www.python.org/
Original-Maintainer: Matthias Klose
我們也可使用 dpkg
的 -p
選項,這個選項提供和 dpkg -s
相類似的資訊,但是它還提供了包的校驗值和包型別。
(LCTT 譯註: 用 dpkg -p
檢視 python3 包的資訊)
$ dpkg -p python3
Package: python3
Priority: important
Section: python
Installed-Size:67
Origin:Ubuntu
Maintainer:UbuntuDevelopers
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Architecture: amd64
Multi-Arch: allowed
Source: python3-defaults
Version:3.6.3-0ubuntu2
Replaces: python3-minimal (<<3.1.2-2)
Provides: python3-profiler
Depends: python3.6(>=3.6.3-1~), libpython3-stdlib (=3.6.3-0ubuntu2), dh-python
Pre-Depends: python3-minimal (=3.6.3-0ubuntu2)
Suggests: python3-doc (>=3.6.3-0ubuntu2), python3-tk (>=3.6.3-1~), python3-venv (>=3.6.3-0ubuntu2)
Filename: pool/main/p/python3-defaults/python3_3.6.3-0ubuntu2_amd64.deb
Size:8712
MD5sum: a8bae494c6e5d1896287675faf40d373
Description: interactive high-level object-oriented language (default python3 version)
Original-Maintainer:MatthiasKlose
SHA1:2daec885cea7d4dc83c284301c3bebf42b23e095
SHA256:865e509c91d2504a16c4b573dbe27e260c36fceec2add3fa43a30c1751d7e9bb
Homepage: http://www.python.org/
Task: minimal, ubuntu-core, ubuntu-core
Description-md5:950ebd8122c0a7340f0a740c295b9eab
Supported:9m
aptitude 命令:檢視 Debian/Ubuntu/Mint 系統上的包資訊
aptitude
是 Debian GNU/Linux 包管理系統的文字介面。它允許使用者檢視已安裝的包的列表,以及完成諸如安裝、升級、刪除包之類的包管理任務。這些管理行為也能從圖形介面來執行。
(LCTT 譯註: 用 aptitude show
檢視 htop 包資訊)
$ aptitude show htop
Package:htop
Version:2.0.2-1
State: installed
Automatically installed:no
Priority: optional
Section: universe/utils
Maintainer:UbuntuDevelopers
Architecture: amd64
UncompressedSize:216 k
Depends: libc6 (>=2.15), libncursesw5 (>=6), libtinfo5 (>=6)
Suggests:lsof,strace
Conflicts:htop:i386
Description: interactive processes viewer
Htopis an ncursed-based process viewer similar to top, but it allows one to scroll the list vertically and horizontally to see all processes and their full command lines.
Tasks related to processes (killing, renicing) can be done without entering their PIDs.
Homepage: http://hisham.hm/htop/
via: https://www.2daygeek.com/how-to-view-detailed-information-about-a-package-in-linux/
作者:Prakash Subramanian 選題:lujun9972 譯者:DavidChenLiang 校對:wxy
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx
本文永久更新連結地址:https://www.linuxidc.com/Linux/2018-09/154135.htm
相關文章