在 ubuntu 上安装 ganglia 时禁止用户输入

在 ubuntu 上安装 ganglia 时禁止用户输入

我正在编写一个 Hadoop 配置脚本,但在安装 ganglia 时遇到了麻烦。该脚本需要在没有任何人工干预的情况下一路运行。不幸的是,当它到达这一行时,它就中断了:

sudo apt-get install ganglia-monitor ganglia-webfrontend

脚本在此处冻结。如果您尝试使用 Ctrl-D 或 Ctrl-C 退出,则在尝试运行一堆命令后会失败

仔细观察,问题在于 ganglia 在安装时需要用户输入。在 apt-get 调用期间,会弹出如下屏幕:

Package configuration

------------------[ Configuring ganglia-webfrontend ]------------------

In order to activate the new configuration, the web server needs to be restarted.
If you choose not to do this automatically, you should do so manually at the first opportunity.                                                                                                              

Restart apache2?
<No>  <Yes>

有什么方法可以避免出现此屏幕?向 apt-get 添加 -y 标签(即 apt-get install ganlgi -y)不起作用。

答案1

在进行交互式安装时,我的 puppet 清单也出现了类似的问题。以下是我所做的。

export DEBIAN_FRONTEND=noninteractive ; 
apt-get -y install ganlgi

相关内容