문제

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?

도움이 되었습니까?

해결책

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

다른 팁

Consider using the postconf tool instead of dpkg-reconfigure.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top