Once you have many Debian servers, maintenance would be a problem. I just counted that I have more then 30 etch servers running in several vserver machines. Sometimes, I would like to install Debian package in all of these servers. However, it takes too much time to ssh /vserver enter into every hosts, and answer the installation questions one by one.
Thanks for the debconf(1), it’s quite easy to do non-interactive installation, since debconf already provide a noninteractive frontend. All you need to do is set the configuration before you install the package. It can be done by debconf-set-selections.
First, you have to install the package in one hosts. It would be better if you install/test the package on the same distribution version and package version. Here is an example for install localepurge. localepurge is a software for superfluous locale data, that will save you some disk space. As a Chinese, I usually don’t need Spanish, Franch and any other hundreds of different locale data.
Once you install the localepurge, you can use debconf-get-selections to dump the configuration you did. The debconf-get-selections is part of the debconf-utils. The command would look like
# debconf-get-selections |grep ^localepurge
localepurge localepurge/quickndirtycalc boolean true
localepurge localepurge/remove_no note
localepurge localepurge/mandelete boolean true
localepurge localepurge/showfreedspace boolean true
localepurge localepurge/verbose boolean false
localepurge localepurge/nopurge multiselect en, en_US.UTF-8, zh, zh_TW, zh_TW.UTF-8
localepurge localepurge/dontbothernew boolean false
localepurge localepurge/none_selected boolean false
So, these are the questions the debconf will ask you. (Since the questions has different priorities, you might not be asked for all the questions) The localepurge/nopurge line is the locales data we want to keep, so we also want to let the other servers have the same settings. You can use debconf-set-selections to set the values in the other servers.
# echo "localepurge localepurge/nopurge multiselect en, en_US.UTF-8, zh, zh_TW, zh_TW.UTF-8"|debconf-set-selections
Then you can now install the package, it will use the default value you just gave. If you need to install many servser, and do not want to see the question dialogs. You can use noninteractive fronetend to bypas the questions.
# DEBIAN_FRONTEND=noninteractive dpkg-reconfigure localepurge
This is a Tips for Debian system.