小编Bri*_*tle的帖子

如何防止 apt-get/aptitude 在安装过程中显示对话框?

我正在尝试构建 Ansible Playbook 以在 Linode 上部署一些 Ubuntu 12.04 服务器,但我的问题似乎是 Ubuntu 问题。当我运行 apt-get 或 aptitude 的不同组合时,我总是会收到以下对话框,我必须对此做出回应。

包配置对话框

我希望从命令行回答这个问题,这样它就不会中断自动部署。有任何想法吗?

我当前的命令如下。请注意,我正在尝试设置 DEBIAN_FRONTEND:

#!/bin/bash

echo 'DEBIAN_FRONTEND="noninteractive"' >> /etc/profile
echo 'DEBIAN_FRONTEND="noninteractive"' >> ~/.profile

source /etc/profile
source ~/.profile

# This next line is the one that pops up the dialog
sudo aptitude -y install iptables-persistent

# Need this to fix an issue with the package post-install (this works fine.)
sudo sed \
    -i 's/\(modprobe -q ip6\?table_filter\)/\1 || true/g' \
    /var/lib/dpkg/info/iptables-persistent.postinst; \
sudo aptitude install iptables-persistent
Run Code Online (Sandbox Code Playgroud)

aptitude iptables apt debconf

29
推荐指数
3
解决办法
8696
查看次数

标签 统计

apt ×1

aptitude ×1

debconf ×1

iptables ×1