简体   繁体   English

在Debian / Ubuntu上防止“ apt install -y iptables持久”提示时提示

[英]Prevent prompt when `apt install -y iptables persistent` on Debian/Ubuntu

I'm making a script of auto-starting server. 我正在制作一个自动启动服务器的脚本。

when I exec following command, I get blue screen prompt. 当我执行以下命令时,出现蓝屏提示。 What the name of the scereen? scereen的名字是什么?

# apt install -y iptables-persistent

The goal what I wanna do is one of following 我想要做的目标是以下之一

  • prevent this prompt to raise 防止出现此提示
  • send command (ENTER) to this prompt 发送命令(ENTER)到此提示

Of course, 2-times manual ENTER solve this problem, but I want to automate this step. 当然,2次手动ENTER可以解决此问题,但是我想使这一步骤自动化。

what I tried: 我试过的

  • # apt install -y iptables-persistent > /dev/null
  • # apt install -y iptables-persistent $ echo "\\n"
  • # expect -c "spawn apt install -y iptables-persistent expect\\"\\(.*\\)\\" send --\\"\\n\\""

[ENVIRONMENT] [环境]

  • Debian 9 Debian 9
  • Ubuntu 18.04 Ubuntu 18.04

Use this command to fully automate the installation 使用此命令可以完全自动化安装

echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
sudo apt-get -y install iptables-persistent

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM