盡管在圖形包管理器的幫助下包管理變得更加容易,但一些用戶總是更喜歡命令行方式。有不同的命令可以在不同的 Linux 版本中找出包版本。今天,在本教程中,我們將看到如何在一些流行的 Linux 發行版中找到軟件包版本,例如 Alpine Linux、Arch Linux 及其衍生產品、Debian 及其衍生產品、RHEL 及其衍生產品。
- 在 Alpine Linux 中查找軟件包版本
- 在基于 Arch 的系統中查找軟件包版本
- 在基于 DEB 的系統中查找包版本
- 在基于 RPM 的系統中查找軟件包版本
在 Alpine Linux 中查找軟件包版本
要查看軟件包版本和其他詳細信息,請使用apk info如下命令。
$ apk info vim
您將看到給定包的簡短描述及其托管網站。
示例輸出:
vim-8.2.2137-r0 description:
Improved vi-style text editor
vim-8.2.2137-r0 webpage:
https://www.vim.org/
vim-8.2.2137-r0 installed size:
18 MiB
gvim-8.2.2137-r0 description:
advanced text editor, with GUI
gvim-8.2.2137-r0 webpage:
https://www.vim.org/
gvim-8.2.2137-r0 installed size:
29 MiB
如您所見,安裝的 Vim 版本是8.2.
在基于 Arch 的系統中查找軟件包版本
要在 Arch Linux 及其衍生產品(如 EndeavourOS 和 Manjaro Linux)中查找已安裝的軟件包(例如 VLC)版本,請運行以下命令:
$ pacman -Q vlc
示例輸出:
vlc 2.2.4-3
正如你在上面的輸出中看到的,VLC 包的安裝版本是2.2.4-3。
要顯示包的詳細信息,請運行:
$ pacman -Qi vlc
示例輸出:
Name : vlc
Version : 2.2.4-3
Description : A multi-platform MPEG, VCD/DVD, and DivX player
Architecture : x86_64
URL : http://www.videolan.org/vlc/
Licenses : LGPL2.1 GPL2
Groups : None
Provides : None
Depends On : a52dec libdvbpsi libxpm libdca libproxy sdl_image
libdvdnav libtiger lua libmatroska zvbi taglib
libmpcdec ffmpeg2.8 faad2 libupnp libshout libmad
libmpeg2 xcb-util-keysyms libtar libxinerama
Optional Deps : avahi: for service discovery using bonjour protocol
[installed]
libnotify: for notification plugin [installed]
gtk2: for notify plugin [installed]
[...]
lua-socket: for http interface
qt4: for the GUI [installed]
Required By : None
Optional For : smtube
Conflicts With : vlc-plugin
Replaces : vlc-plugin
Installed Size : 53.28 MiB
Packager : Antonio Rojas
Build Date : Sun 24 Jul 2016 03:12:59 PM IST
Install Date : Fri 05 Aug 2016 11:22:54 AM IST
Install Reason : Explicitly installed
Install Script : No
Validated By : Signature
在基于 DEB 的系統中查找包版本
在 Debian、Ubuntu 及其衍生產品(例如 Linux Mint、Pop OS 和 Elementary OS)中,我們可以找到已安裝的軟件包,例如 Apache webserver,使用dpkg帶有-l開關的命令的版本如下:
$ dpkg -l apache2
或者,您可以使用dpkgwithgrep命令來獲取安裝版本的軟件包,如下所示。
$ dpkg -s apache2 | grep -i version
示例輸出:
Version: 2.4.18-2ubuntu3.1
要顯示已安裝軟件包的詳細信息,請運行:
$ dpkg -s apache2
示例輸出:
Package: apache2
Status: install ok installed
Priority: optional
Section: httpd
Installed-Size: 488
Maintainer: Ubuntu Developers
Architecture: amd64
Version: 2.4.18-2ubuntu3.1
Replaces: apache2.2-bin, apache2.2-common
Provides: httpd, httpd-cgi
Depends: lsb-base, procps, perl, mime-support, apache2-bin (= 2.4.18-2ubuntu3.1), apache2-utils (>= 2.4), apache2-data (= 2.4.18-2ubuntu3.1)
Pre-Depends: dpkg (>= 1.17.14)
Recommends: ssl-cert
Suggests: www-browser, apache2-doc, apache2-suexec-pristine | apache2-suexec-custom, ufw
Conflicts: apache2.2-bin, apache2.2-common
Conffiles:
/etc/apache2/apache2.conf da32fcc6a783acaebf0d74c17c726bf7
/etc/default/apache-htcacheclean ae8721a0bc5b4e2ef7a5258b1e9db5c5
[..]
/etc/logrotate.d/apache2 7322a4f050c1e2454249695236a3472c
/etc/ufw/applications.d/apache2-utils.ufw.profile f8d4fd920e598ceb4379613c6261f6af
Description: Apache HTTP Server
The Apache HTTP Server Project'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.
Homepage: http://httpd.apache.org/
Original-Maintainer: Debian Apache Maintainers
此外,我們可以使用以下apt-show-versions命令查找軟件包版本:
$ apt-show-versions apache2
示例輸出:
apache2:amd64/xenial-security 2.4.18-2ubuntu3.1 uptodate
apache2:i386 not installed
如上結果所示,我安裝了 apache2 64位版本,版本為 2.4.18。
如果沒有安裝'apt-show-versions'程序,您可以使用以下命令安裝它:
$ sudo apt install apt-show-versions
我們現在知道如何檢查已安裝軟件包的版本。在線存儲庫中的軟件包版本如何?無論如何要檢查官方存儲庫中可用的軟件包版本?這也是可能的。查看以下鏈接以了解操作方法。
即使這些軟件包沒有安裝在基于 Debian 的系統中,您仍然可以找到它們的版本。查看以下指南了解更多詳情。
在基于 RPM 的系統中查找軟件包版本
要在基于 RPM 的發行版(例如 Red Hat、CentOS、Fedora、AlmaLinux、Rocky Linux 和 openSUSE 等)中找出已安裝軟件包(例如 httpd)的版本,請運行:
$ rpm -qi httpd
示例輸出:
Name : httpd
Version : 2.4.6
Release : 40.el7.centos.4
Architecture: x86_64
Install Date: Thu 11 Aug 2016 08:08:45 PM IST
Group : System Environment/Daemons
Size : 9806117
License : ASL 2.0
Signature : RSA/SHA256, Mon 18 Jul 2016 09:35:16 PM IST, Key ID 24c6a8a7f4a80eb5
Source RPM : httpd-2.4.6-40.el7.centos.4.src.rpm
Build Date : Mon 18 Jul 2016 09:02:11 PM IST
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem
上面的命令顯示安裝的包版本、構建日期、許可證、描述等。正如你在輸出中看到的,httpd 包版本是2.4.6。
-
Linux
+關注
關注
87文章
11345瀏覽量
210415 -
管理器
+關注
關注
0文章
248瀏覽量
18617
發布評論請先 登錄
相關推薦
關于openEuler軟件包加固測試的經驗
香橙派R1 Plus開發板安裝非官方源的軟件包的注意事項
在linux編譯中升級gcc無法定位軟件包libmpfr4請問怎么解決
RT-Thread5.0.0版本下littlefs軟件包編譯出錯如何解決?
惠普推全新數據科學軟件包,簡化數據科學
什么是Linux軟件包,如何管理它們
RZ/Five Verified Linux 軟件包 V3.0.2-update1 組件列表
![RZ/Five Verified <b class='flag-5'>Linux</b> <b class='flag-5'>軟件包</b> V3.0.2-update1 組件列表](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
RZ/Five Verified Linux 軟件包 V3.0.2-update1 組件列表
![RZ/Five Verified <b class='flag-5'>Linux</b> <b class='flag-5'>軟件包</b> V3.0.2-update1 組件列表](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
RT-Thread在線軟件包改為本地軟件包的方法
![RT-Thread在線<b class='flag-5'>軟件包</b>改為本地<b class='flag-5'>軟件包</b>的方法](https://file1.elecfans.com/web2/M00/90/34/wKgaomTV3BWAY_RKAAEC9HeRKXM649.jpg)
RT-Thread中mymqtt軟件包的使用方法
![RT-Thread<b class='flag-5'>中</b>mymqtt<b class='flag-5'>軟件包</b>的使用方法](https://file1.elecfans.com/web2/M00/A7/F7/wKgaomUorsCAacB1AAA5N-PCBs4615.jpg)
RZ/G驗證的Linux軟件包V2.1.20-RT 發布說明
![RZ/G驗證的<b class='flag-5'>Linux</b><b class='flag-5'>軟件包</b>V2.1.20-RT 發布說明](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
評論