30

I would like to install chef via apt non-interactively, but by default, apt installation brings up this prompt:

apt install chef prompt

Is there a way to skip this step during installation or pass a value to apt install? I'm only using chef-solo, so don't actually need the server component, so simply press return on this prompt.

29

You can configure debconf into non-interactive prompt:

sudo DEBIAN_FRONTEND=noninteractive aptitude install -y -q chef

If you find the complete key, you can also pre-configure the default value:

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

To be precise:

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

To find the key, after installing you can look for:

sudo debconf-get-selections | grep chef
# URL of Chef Server (e.g., http://chef.example.com:4000):
chef    chef/chef_server_url    string  
  • In some environments debconf-get-selections may no be available, use debconf-show PACKAGENAME then – Jaleks Dec 29 '16 at 10:16
  • If debconf-get-selections is not available, try installing package debconf-utils. – daveloyall Jul 7 '17 at 19:15
  • 2
    Also in Ubuntu 16.04 LTS there is debconf-show package which will show all available options for given package (after it was installed) the same way as debconf-get-selections did (if debconf-get-selections is missing) – Dalibor Filus Feb 14 '18 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.