I'm trying to create a script that automatically downloads packages for new servers. However, some things like 'mysql-server' can not installed automatically cause you need to configure them in the ncurses interface first. I've looked through the man pages and can't find anything appropriate.
I don't care if I have to upload/edit a conf file later -- I just need the appropriate packages installed.
Anyone know what to do besides grabbing tarballs and building them myself?
UPDATE found out that for things like mysql-server you can just do:
DEBIAN_FRONTEND='noninteractive' apt-get install -yq mysql-server
however expect looks like something I'll need for sun-java6-jdk; haven't evaluated it yet
Answer from ossramblings.com:
First, install your package normally; then, extract the configuration answers from the debconf data files:
Then, for other installations, you can apply it before installing the package:
For packages that ask questions through debconf (which is what puts up the ncurses display), you can pre-answer the questions. For sun-java, the questions can be pre-answered by following the instructions at http://www.davidpashley.com/blog/debian/java-license
I'm not sure exactly what configuration mysql-server needs, but you could try something like expect
I would look into cron-apt. I haven't tried it myself, but it's package description sounds promising.
Any Debian package which uses
debconf
to get configuration values can be run unattended. The trick is thatdebconf
will first search for pre-installed answers to any config question which a given package has.Pre-install config answers
Just create a file in the following format,
and feed it into the system like so:
Now, you're ready to
apt-get install
, as usual.One-off
Since this command also reads from stdin, you can do:
Finding default answers
How do you know which packages use these configuration answers? Well, if you've already installed the package in question interactively, you can query your local system to see what values are currently configured.
debconf-get-selections
prints a list of all config answers for the current system. For examplereturns the following on my system:
You may need to install the
debconf-utils
package to make this command available.Sample
Sources