天天看點

apt-get upgarde和dist-upgrade的差别

apt-get upgarde和dist-upgrade的差别

apt-get upgarde和dist-upgrade的差别

Debian/Ubuntu Linux都使用apt,更新時都是: 

  www.2cto.com  

apt-get update 

apt-get upgrade 

apt-get dist-upgrade 

但是常常有人會問, 

upgrade和dist-upgrade有何不同,仔細查查,似乎大家對upgrade和dist-upgrade的解釋

都有點不同,在此也紀錄自己的看法. 

我認為apt-get 

upgrade和dist-upgrade的差别:   www.2cto.com  

upgrade:系統将現有的Package更新,如果有相依性的問題,而此相依性需要安裝其它新的

Package或影響到其它Package的相依性時,此Package就不會被更新,會保留下來. 

dist-upgrade:可以聰明的解決相依性的問題,如果有相依性問題,需要安裝/移除新的Package,

就會試着去安裝/移除它. 

(是以通常這個會被認為是有點風險的更新) 

apt-get upgrade 和 apt-get dist-upgrade 本質上是沒有什麼不同的。

隻不過,dist-upgrade 

會識别出當依賴關系改變的情形并作出處理,而upgrade對此情形不處理。

例如軟體包 a 原先依賴 b c d,但是在源裡面可能已經更新了,現在是 a 依賴 b c 

e。這種情況下,dist-upgrade 會删除 d 安裝 e,并把 a 軟體包更新,而 upgrade 會認為

依賴關系改變而拒絕更新 a 

軟體包。  www.2cto.com  

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

That which didn't kill me makes me stronger