我正在远程服务器上安装软件包,使用ssh
:
ssh root@my-host "DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get --quiet --yes install w3m"
即使我已经设置DEBIAN_FRONTEND=noninteractive
,安装卡在以下问题上,我必须手动按 enter:
Configuration file '/etc/w3m/config'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** config (Y/I/N/O/D/Z) [default=N] ?
我怀疑,这个问题是由dpkg --configure -a
而不是由提出的apt-get
,因此非交互式被忽略了。
如何自动执行此操作并自动选择默认选项而不被询问?
这种配置文件更改冲突由 处理
dpkg
,您可以使用该选项强制它选择默认--force-confdef
选项。请注意文档中的警告:要在 APT 调用时提供此选项
dpkg
,您需要将其添加到 APT 设置中,例如通过将以下行添加到/etc/apt/apt.conf
:或者,对于单次调用:
DEBIAN_FRONTEND=noninteractive
只影响debconf
,并且在这种情况下根本不涉及。