jim*_*tie 359 upgrade dist-upgrade
我通常apt-get update && apt-get upgrade用来运行我的更新和升级而不是 GUI,因为它似乎运行得更快。
但是,我最近注意到我经常收到一条消息,说我的一个升级被阻止了。然后我通常运行dist-upgrade它通过它并且它工作正常。据我所知,在阅读这个问题及其答案后,会dist-upgrade做所有相同的事情,然后做一些事情。
所以,我的问题是:为什么要使用apt-get upgrade?为什么不一直使用apt-get dist-upgrade?为什么apt-get upgrade还要存在?
rdu*_*ain 488
我通常使用以下方法升级我的机器:
sudo apt-get update && time sudo apt-get dist-upgrade
Run Code Online (Sandbox Code Playgroud)
以下是摘录自man apt-get。使用升级遵循规则:在任何情况下都不会删除当前安装的软件包,或者检索和安装尚未安装的软件包。如果这对您很重要,请使用apt-get upgrade. 如果您希望事情“正常工作”,您可能希望apt-get dist-upgrade确保解决依赖关系。
要详细说明为什么要升级而不是dist-upgrade,如果您是系统管理员,则需要可预测性。您可能正在使用高级功能,例如apt 固定或从PPA集合中提取(也许您有一个内部 PPA),使用各种自动化来检查您的系统和可用升级,而不是总是急切地升级所有可用包。当 apt 执行非脚本行为时,您会感到非常沮丧,特别是如果这会导致生产服务停机。
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 important ones if necessary. So, dist-upgrade
command may remove some packages. The /etc/apt/sources.list file
contains a list of locations from which to retrieve desired package
files. See also apt_preferences(5) for a mechanism for overriding
the general settings for individual packages.
Run Code Online (Sandbox Code Playgroud)
Ste*_*ico 151
我知道这个问题已经回答了并且已经有一年了,但我觉得这需要说。Ubuntu的14.04和更高(和Debian杰西和以后,对于那些从谷歌发现此)使用APT 1.0,这允许该命令apt,而不是apt-get和apt-cache用于一些操作。
apt-get upgrade 不会更改已安装的内容(仅限版本), apt-get dist-upgrade 将根据需要安装或删除软件包以完成升级, apt upgrade 将自动安装但不会删除软件包。apt full-upgrade执行与 相同的功能apt-get dist-upgrade。该upgrade选项仅安装系统上已安装的软件包的新版本(是的,内核更新属于它们)。
但是,有时更新会更改依赖项:例如,包的新版本将不再依赖于您已安装的库,或者需要安装其他库。该upgrade选项永远不会删除您不再实际需要的已安装软件包。
但是,该dist-upgrade选项可以“智能地”处理依赖项系统中的更改。这包括删除不再需要的包或解决由于依赖项更改而出现的包之间的冲突。