使用 debconf-set-selections 自动安装 Postfix?

使用 debconf-set-selections 自动安装 Postfix?

我目前正在尝试自动化我的 Postfix 安装,并且大多数事情确实有效......但我似乎无法阻止 postfix-policyd 询问 MySQL 根密码。

以下是我目前得到的信息:

回显‘dbconfig-common postfix-policyd/dbconfig-install boolean false’| debconf-set-selections

回显‘postfix-policyd postfix-policyd/dbconfig-install boolean false’| debconf-set-selections

回显‘postfix-policyd postfix-ploicyd/internal/skip-preseed boolean false’| debconf-set-selections

回显'dbconfig-common dbconfig-common/internal/skip-preseed boolean false'| debconf-set-selections

回显‘postfix-policyd postfix-policyd/dbconfig-upgrade boolean false’| debconf-set-selections

回显‘postfix-policyd/dbconfig-reinstall boolean false’| debconf-set-selections

回显‘dbconfig-common dbconfig-reinstall boolean false’| debconf-set-selections

回显“postfix-policyd postfix-policyd/internal/reconfiguring boolean false”| debconf-set-selections

看来 postfix-policyd 只是忽略了

postfix-policyd postfix-policyd/dbconfig-install 布尔值 false

我该如何解决?

答案1

在我的脚本中我首先禁用交互式前端:
export DEBIAN_FRONTEND=noninteractive

然后我设置了所有的偏好,例如:
postconf -e "mynetworks = 127.0.0.0/8, ${NETWORK_CIDR}"

然后您可以通过取消设置来重新启用它:
unset DEBIAN_FRONTEND

或者,只需运行以下命令即可轻松完成:
DEBIAN_FRONTEND=noninteractive apt-get install postfix-policyd

答案2

要设置 MySQL 密码,您需要对脚本执行以下操作:

ADMIN_PASS=YourPassword

#MySql settings
echo "mysql-server-5.6 mysql-server/root_password password $ADMIN_PASS" \
  | debconf-set-selections

echo "mysql-server-5.6 mysql-server/root_password_again password $ADMIN_PASS" \
  | debconf-set-selections

只需更改 MySQL 版本的数字

相关内容