apt-get安装,没有debconf提示符


31

我想以非交互方式通过apt安装Chef,但默认情况下,apt安装会显示以下提示:

apt安装厨师提示

有没有办法在安装过程中跳过此步骤或将值传递给apt install?我仅使用chef-solo,因此实际上不需要服务器组件,因此只需在此提示上按回车即可。

Answers:


31

您可以将debconf配置为非交互式提示:

sudo DEBIAN_FRONTEND=noninteractive aptitude install -y -q chef

如果找到完整密钥,则还可以预先配置默认值:

echo package package/key {boolean,string} {true, some string} | sudo debconf-set-selections
sudo apt-get install package

确切地说:

echo chef chef/chef_server_url string | sudo debconf-set-selections

要找到密钥,请安装查找:

sudo debconf-get-selections | grep chef
# URL of Chef Server (e.g., http://chef.example.com:4000):
chef    chef/chef_server_url    string  

在某些环境中debconf-get-selections可能没有提供,使用debconf-show PACKAGENAME然后
Jaleks

如果debconf-get-selections不可用,请尝试安装package debconf-utils
daveloyall

3
同样在Ubuntu 16.04 LTS中debconf-show package,它将以与安装软件包相同的方式debconf-get-selections(如果debconf-get-selections缺少)显示给定软件包的所有可用选项
Dalibor Filus
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.