使用 `apt-get` 时如何以编程方式跳过粉红色 Ubuntu 用户提示?

How can I programmatically skip the pink Ubuntu user prompt when using `apt-get`?

使用 apt-get 包管理器在 Ubuntu 上安装 CouchDB 2.1 时,如下所示:

echo "deb https://apache.bintray.com/couchdb-deb xenial main" | sudo tee -a /etc/apt/sources.list
curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | sudo apt-key add -
apt-get update
apt-get install couchdb -y

我收到一个提示屏幕,询问我是要以单节点模式还是集群模式安装,或者我是否要自己配置 Couch。 (不是命令提示符,而是带有我必须按下的按钮的粉红色背景)。

我想自己配置 Couch,尽管我需要能够以编程方式跳过查看屏幕(因为我自己不是 运行 命令 - 命令是脚本的一部分)。

如何指定在使用 apt-get install couchdb -y 安装 CouchDB 2.1 时自动指定此选项?

或者,如果我不想手动按下“确定”按钮,我是否会被迫从源代码安装 CouchDB?

您收到的提示来自 debconf 系统,用于配置程序包。您可以使用 debconf 预先配置软件包,这样它就不需要在安装过程中询问这些问题。此过程称为 "preseeding",通常在系统安装过程中完成,以便一次在系统上预置所有软件包。但是您也可以为单个包裹执行此操作。

可以找到 debconf 预置文档 here