2

When installing CouchDB 2.1 on Ubuntu using the the apt-get package manager, like so:

echo "deb https://apache.bintray.com/couchdb-deb xenial main" | sudo tee -a /etc/apt/sources.list
curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | sudo apt-key add -
apt-get update
apt-get install couchdb -y

I get a prompt screen asking if I would like to install in single node mode, or clustered mode, or if I would like to configure Couch myself. (Not a command prompt, but a pink background with a button that I have to press).

I would like to configure Couch myself, though I need to be able to programmatically skip the review screen (since I'm not running the command myself - the command is part of a script).

How can I specify to automatically specify this option when installing CouchDB 2.1 using apt-get install couchdb -y?

Alternatively, would I be forced to install CouchDB from the source if I don't want to manually press the ok button?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Zach Smith
  • 8,458
  • 13
  • 59
  • 133
  • Those sorts of prompts usually have a check to make sure that input is coming from a tty. See what happens if you redirect your script's stdin from somewhere else, or even close it, i.e. `my_script.sh <&-` – ccarton Aug 16 '17 at 08:31
  • Thank you @ccarton. i tested this by creating a file `x.sh`, with the command `apt-get install couchdb -y`, and then ran the script via `./x.sh <&-`. Didn't work... but did i test correctly? – Zach Smith Aug 17 '17 at 08:55

1 Answers1

2

The prompt you receive comes from the debconf system, to configure the package. You can pre-configure the package using debconf, so that it doesn't need to ask the questions during installation. This process is called "preseeding", and is usually done during system installs to preseed all packages on a system at once. But you can do it for a single package, too.

The documentation for preseeding of debconf can be found here.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189