如何檢查 apt 鏡像是否有我需要的軟體包版本?

如何檢查 apt 鏡像是否有我需要的軟體包版本?

假設我想查詢openssl, 1.0.1-4ubuntu5.12鏡像中是否可用,例如

deb http://security.ubuntu.com/ubuntu precise-security main restricted

我可以檢查任何簡單的命令嗎?

答案1

你可以運行apt-get install -s openssl -t precise-security

  • -s標誌只是為了模擬安裝
  • -t標誌指定目標版本

這將返回類似:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  openssl
1 upgraded, 0 newly installed, 0 to remove and 64 not upgraded.
Inst openssl [1.0.1-4ubuntu5.11] (1.0.1-4ubuntu5.12 Ubuntu:12.04/precise-security [amd64])
Conf openssl (1.0.1-4ubuntu5.12 Ubuntu:12.04/precise-security [amd64])

現在,從這裡,您可以看到該版本openssl 1.0.1-4ubuntu5.12在此存儲庫中可用。

但是,只有當儲存庫包含比您系統上安裝的版本更新的版本時,才會報告此情況。


apt-cache policy openssl將報告您在sources.list檔案中定義的每個儲存庫的可用版本(即使您的系統已經是最新的 - 這不是我的情況):

openssl:
  Installed: 1.0.1-4ubuntu5.11
  Candidate: 1.0.1-4ubuntu5.12
  Version table:
     1.0.1-4ubuntu5.12 0
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
 *** 1.0.1-4ubuntu5.11 0
        500 http://fr.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1.0.1-4ubuntu3 0
        500 http://fr.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

相關內容