分享技术,记录生活,在互联网上留下属于自己的一亩三分地。

Kali2.0 update、upgrade、dist-upgrade三者的区别

Linux novadmin 273℃ 0评论

update:

update is used to resynchronize the packageindex files from their sources. The indexes of available packages are fetchedfrom the location(s) specified in /etc/apt/sources.list. For example, whenusing a Debian archive, this command retrieves and scans the Packages.gz files,so that information about new and updated packages is available. An updateshould always be performed before an upgrade or dist-upgrade. Please be awarethat the overall progress meter will be incorrect as the size of the packagefiles cannot be known in advance.

upgrade:

upgrade is used to install the newestversions 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 circumstancesare currently installed packages removed, or packages not already installed retrieved and installed. Newversions of currently installed packages that cannot be upgraded without changing the install statusof another package will be left at their current version. An update must be performed first so that apt-getknows that new versions of packages are available.

dist-upgrade:

dist-upgrade in addition to performing the function of upgrade, alsointelligently 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 lessimportant ones if necessary. The /etc/apt/sources.list file contains a list of locations from which toretrieve desired package files. See also apt_preferences(5) for a mechanism for overriding the generalsettings for individual packages.

上面内容均是从apt-get的man文档里面截取下来的,从英文内容我们可以知道:

update:当执行apt-get update时,update重点更新的是来自软件源的软件包的索引记录(即index files)。

upgrade:当执行apt-get upgrade时,upgrade是根据update更新的索引记录来下载并更新软件包。

dist-upgrade:当执行apt-get dist-upgrade时,除了拥有upgrade的全部功能外,dist-upgrade会比upgrade更智能地处理需要更新的软件包的依赖关系。

从上述可以看出,在执行apt-get upgrade和apt-get dist-upgrade之前应该先执行apt-get update。

 

我认为apt-get
upgrade和dist-upgrade的差别:

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
软件包。

转载请注明:Nov » Kali2.0 update、upgrade、dist-upgrade三者的区别

喜欢 (0)or分享 (0)
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址