How to check the version before installing a package using apt-get?

前端 未结 10 2067
陌清茗
陌清茗 2021-01-29 17:52

I\'m thinking to install hylafax+ version 5.5.4 which was release last month on my Debian PC.

I checked dpkg -l | grep "hylafax" and found

相关标签:
10条回答
  • 2021-01-29 18:42

    As posted somewhere else, this works, too:

    apt-cache madison <package_name>

    0 讨论(0)
  • 2021-01-29 18:44

    Linux Mint, Debian 9, Ubuntu 16.04 and older:

    Short info:

    apt policy <package_name>
    

    Detailed info (With Description and Depends):

    apt show <package_name>
    
    0 讨论(0)
  • 2021-01-29 18:48

    You can also just simply do the regular apt-get update and then, as per the manual, do:

    apt-get -V upgrade

    -V Show verbose version numbers

    Which will show you the current package vs the one which will be upgraded in a format similar to the one bellow:

    ~# 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] 
    
    0 讨论(0)
  • 2021-01-29 18:50

    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
    

    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])
    

    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
    

    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
    
    0 讨论(0)
提交回复
热议问题