如何在使用apt-get安装软件包之前检查版本

Yas*_*u G 154 debian apt version dpkg apt-get

我正在考虑安装上个月在我的Debian PC 上发布的hylafax + 5.5.4版本.

我查了一下dpkg -l | grep "hylafax",发现当前的版本是5.5.3.然后我检查apt-cache search hylafax并看到包可用,但我看不到任何版本号.

如何找到可用的软件包版本apt-get

Yas*_*u G 271

好的,我找到了.

apt policy <package name> 将显示版本详细信息.

它还显示当前安装的版本以及可安装的版本.

例如, apt-cache policy hylafax+

  • 不敢相信这没有显示在“apt install”中,让您有机会在说“Y”之前查看版本。 (6认同)

Ant*_*han 31

apt-cache policy <package-name>

$ apt-cache policy redis-server
redis-server:
  Installed: (none)
  Candidate: 2:2.8.4-2
  Version table:
     2:2.8.4-2 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
Run Code Online (Sandbox Code Playgroud)

apt-get install -s <package-name>

$ apt-get install -s redis-server
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libjemalloc1 redis-tools
The following NEW packages will be installed:
  libjemalloc1 redis-server redis-tools
0 upgraded, 3 newly installed, 0 to remove and 3 not upgraded.
Inst libjemalloc1 (3.5.1-2 Ubuntu:14.04/trusty [amd64])
Inst redis-tools (2:2.8.4-2 Ubuntu:14.04/trusty [amd64])
Inst redis-server (2:2.8.4-2 Ubuntu:14.04/trusty [amd64])
Conf libjemalloc1 (3.5.1-2 Ubuntu:14.04/trusty [amd64])
Conf redis-tools (2:2.8.4-2 Ubuntu:14.04/trusty [amd64])
Conf redis-server (2:2.8.4-2 Ubuntu:14.04/trusty [amd64])
Run Code Online (Sandbox Code Playgroud)

apt-cache show <package-name>

$ apt-cache show redis-server
Package: redis-server
Priority: optional
Section: universe/misc
Installed-Size: 744
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Chris Lamb <lamby@debian.org>
Architecture: amd64
Source: redis
Version: 2:2.8.4-2
Depends: libc6 (>= 2.14), libjemalloc1 (>= 2.1.1), redis-tools (= 2:2.8.4-2), adduser
Filename: pool/universe/r/redis/redis-server_2.8.4-2_amd64.deb
Size: 267446
MD5sum: 066f3ce93331b876b691df69d11b7e36
SHA1: f7ffbf228cc10aa6ff23ecc16f8c744928d7782e
SHA256: 2d273574f134dc0d8d10d41b5eab54114dfcf8b716bad4e6d04ad8452fe1627d
Description-en: Persistent key-value database with network interface
 Redis is a key-value database in a similar vein to memcache but the dataset
 is non-volatile. Redis additionally provides native support for atomically
 manipulating and querying data structures such as lists and sets.
 .
 The dataset is stored entirely in memory and periodically flushed to disk.
Description-md5: 9160ed1405585ab844f8750a9305d33f
Homepage: http://redis.io/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubunt
Run Code Online (Sandbox Code Playgroud)

dpkg -l <package-name>

$ dpkg -l nginx
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                     Version                   Architecture              Description
+++-========================================-=========================-=========================-=====================================================================================
ii  nginx                                    1.6.2-1~trusty            amd64                     high performance web server
Run Code Online (Sandbox Code Playgroud)

  • 请注意,`dpkg -l`仅列出已安装的软件包.提前查看版本没用. (2认同)

pvi*_*ent 10

apt policy <package>
Run Code Online (Sandbox Code Playgroud)

简而言之


mat*_*ure 7

Linux Mint,Debian 9,Ubuntu 16.04和更低版本:

简短信息

apt policy <package_name>
Run Code Online (Sandbox Code Playgroud)

详细信息(带有说明和取决于):

apt show <package_name>
Run Code Online (Sandbox Code Playgroud)


Onl*_*job 6

以下可能效果很好:

aptitude versions ^hylafax+
Run Code Online (Sandbox Code Playgroud)

aptitude中查看更多(8)


Fra*_*kie 6

您也可以简单地执行常规操作apt-get update,然后按照手册执行以下操作:

apt-get -V upgrade

-V 显示详细版本号

这将向您显示当前的软件包与将以类似于以下格式的格式升级的软件包:

~# sudo apt-get -V upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
   curl (7.38.0-4+deb8u14 => 7.38.0-4+deb8u15)
   php5 (5.6.40+dfsg-0+deb8u2 => 5.6.40+dfsg-0+deb8u3)
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.0 MB of archives.
After this operation, 567 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Run Code Online (Sandbox Code Playgroud)

  • 如果您想更新系统并一次性查看所有版本更改,而不是在每个包上调用“apt-cache策略”,这比接受的答案要好得多 (2认同)

Tra*_*roy 5

在 Debian 上:

apt list --upgradable
Run Code Online (Sandbox Code Playgroud)

给出包含包、要升级的版本以及包的实际版本的列表。

结果 :

base-files/stable 8+deb8u8 amd64 [upgradable from: 8+deb8u7]
bind9-host/stable 1:9.9.5.dfsg-9+deb8u11 amd64 [upgradable from: 1:9.9.5.dfsg-9+deb8u9]
ca-certificates/stable 20141019+deb8u3 all [upgradable from: 20141019+deb8u2]
certbot/jessie-backports 0.10.2-1~bpo8+1 all [upgradable from: 0.8.1-2~bpo8+1]
dnsutils/stable 1:9.9.5.dfsg-9+deb8u11 amd64 [upgradable from: 1:9.9.5.dfsg-9+deb8u9]
Run Code Online (Sandbox Code Playgroud)