Question

How do I write a Bash script to install and configure Postfix (for Debian or Ubuntu).

This is how I install Postfix:

 sudo apt-get install postfix

Then I re-configure it:

sudo dpkg-reconfigure postfix

How do I make a script which automatically answers the questions of the reconfiguration with a predefined set of answers? Or is there any other way to do it?

Was it helpful?

Solution

To show the package related debconf keys and values use debconf-show packagename.

For example the package "samba-common":

To get a single key and value from commandline use echo "get samba-common/encrypt_passwords" | debconf-communicate.

To set a single key and value from commandline use echo "set samba-common/encrypt_passwords false" | debconf-communicate.

This has the advantage, that your changes will survive debian package upgrades.

All other configuration should done with teh adviced postconf utility.

Source: http://feeding.cloud.geek.nz/2010/10/manipulating-debconf-settings-on.html

OTHER TIPS

Consider using the postconf tool instead of dpkg-reconfigure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top