这是我尝试安装软件包的任意示例(本例中为 wine):
sudo apt install wine
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
fonts-wine libcapi20-3 libodbc2 libosmesa6 libwine libz-mingw-w64 wine64
Suggested packages:
odbc-postgresql tdsodbc q4wine winbind winetricks playonlinux wine-binfmt dosbox wine64-preloader
Recommended packages:
wine32
The following NEW packages will be installed:
fonts-wine libcapi20-3 libodbc2 libosmesa6 libwine libz-mingw-w64 wine wine64
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 104 MB of archives.
After this operation, 698 MB of additional disk space will be used.
Do you want to continue? [Y/n]
从输出中,有两个类别(大概是可选的):
Suggested packages:
Recommended packages:
我的理解是--install-suggests
会安装Suggested packages
而--no-install-recommends
不会安装Recommended packages:
我的理解正确吗?
我的困惑和问题是(相对于输出)这两个选项到底有什么作用?
我假设--install-suggests
将安装Suggested packages
,这一定意味着Suggested packages
不会自动安装,这是正确的吗?
另一方面,我假设除非指定,Recommended packages:
否则会自动安装。--no-install-recommends
我的理解正确吗?如果不正确,我应该如何使用与输出相关的这两个选项?
更令人困惑的是,这两个选项似乎是相互排斥的,因为一个具有负面含义,而另一个具有正面含义。
这些选项的描述如下
man apt-get
:--no-install-recommends
:--install-suggests
:您的理解是正确的:默认情况下,
apt
安装推荐的软件包,并忽略建议的软件包。--install-suggests
添加建议的包,并--no-install-recommends
忽略推荐的包。这些选项并不相互排斥。apt
这些默认值可以通过使用上面文档中提到的配置项编辑配置来更改。事实上,这就是命令行选项的实现方式:从默认值加载配置,然后使用配置文件更新,并且任何命令行标志再次更新它们。所以--no-install-recommends
禁用APT::Install-Recommends
,--install-suggests
启用APT::Install-Suggests
。也可以使用相反的选项,--install-recommends
并且--no-install-suggests
。另请参阅推荐和建议如何与 apt-get dist-upgrade 和 apt-get autoremove 交互?