Debian

從目標版本升級單個包

  • April 4, 2013

在 Debian Squeeze 中,我從 debian-backports 安裝了一個 packageX。

**Q1:**當 Iapt-get dist-upgradeaptitude full-upgrade時,檢查哪個版本的 packageX 更新?debian-backports 還是 debian-stable?

**Q2:**我可以使用命令從特定版本更新單個包嗎?例如是aptitude -t full-upgrade packageX一個有效的命令?我試過aptitude -st full-upgrade packageX了,但輸出沒有幫助。

**Q3:**為了完整起見,基於 RPM 的發行版的等效答案是什麼?

Q1:這取決於您目前的優先事項。apt-cache policy您可以使用該命令查看優先級。以下是輸出中的幾行範例:

500 http://security.debian.org/ stable/updates/main amd64 Packages
    release v=6.0,o=Debian,a=stable,n=squeeze,l=Debian-Security,c=main
    origin security.debian.org

100 http://backports.debian.org/debian-backports/ squeeze-backports/main amd64 Packages
    release o=Debian Backports,a=squeeze-backports,n=squeeze-backports,l=Debian Backports,c=main
    origin backports.debian.org

您還可以apt-cache policy在單個包上使用:

$ apt-cache policy linux-image-2.6-amd64 
linux-image-2.6-amd64:
 Installed: (none)
 Candidate: 2.6.32+29
 Version table:
    3.2+46~bpo60+1 0
       100 http://backports.debian.org/debian-backports/ squeeze-backports/main amd64 Packages
    2.6.32+29 0
       500 http://apt.magazines.com/debian/ stable/main amd64 Packages

優先級解釋apt_preferences(5)如下:

  P > 1000
      causes a version to be installed even if this constitutes a downgrade of the package

  990 < P <=1000
      causes a version to be installed even if it does not come from the target release, unless the installed version is more recent

  500 < P <=990
      causes a version to be installed unless there is a version available belonging to the target release or the installed version is more recent

  100 < P <=500
      causes a version to be installed unless there is a version available belonging to some other distribution or the installed version is more recent

  0 < P <=100
      causes a version to be installed only if there is no installed version of the package

  P < 0
      prevents the version from being installed

在我們的範例中,這意味著如果給定的包已經從 backports 安裝,它將從 backports 升級。如果它不是從 backports 安裝的,則不會使用 backports 儲存庫。

Q2 : 該install命令用於升級單個包。如果在給出時軟體包已經安裝install,如果有升級,它將被升級。

apt-get install packageX
aptitude install packageX

Q3:對於基於 RPM 的發行版,它取決於發行版。諸如此類的事情yum不會以rpm與. 用於升級和遠端管理的工具因發行版而異。( RHEL) 和(SLES) 命令是最常用的。apt``dpkg``yum``zypper

引用自:https://unix.stackexchange.com/questions/71181