APT upgrade 和 dist-upgrade 的差別

Debian/Ubuntu Linux 都使用 apt, 升級時都是:

  • apt-get update
  • apt-get upgrade
  • apt-get dist-upgrade

但是常常有人會問, upgrade 和 dist-upgrade 有何不同, 仔細查查, 似乎大家對 upgrade 和 dist-upgrade 的解釋都有點不同, 在此也紀錄自己的看法.

我認為 apt-get upgrade 和 dist-upgrade 的差別:

  • upgrade: 系統將現有的 Package 升級, 如果有相依性的問題, 而此相依性 需要安裝其它新的 Package 或 影響到其它 Package 的相依性時, 此 Package 就不會被升級, 會保留下來.
  • dist-upgrade: 可以聰明的解決相依性的問題, 如果有相依性問題, 需要 安裝/移除 新的 Package, 就會試著去 安裝/移除 它. (所以通常這個會被認為是有點風險的升級)

man apt-get 的解釋:

  • upgrade: upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.
  • dist-upgrade: dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less

upgrade 和 dist-upgrade 差異的範例 可見: Some upgrades show packages being kept back

其它相關網頁

作者: Tsung

對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.

在〈APT upgrade 和 dist-upgrade 的差別〉中有 1 則留言

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料