Another way it can be done is by creating a file e.g. myconf:
postfix postfix/main_mailer_type select Internet Site
postfix postfix/mailname string your.hostname3.com
Then call debconf-set-selections and pass the file as argument:
debconf-set-selections myconf
You can also do like other answers by piping the strings into debconf-set-selections instead:
echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections
echo "postfix postfix/mailname string your.hostname3.com" | debconf-set-selections
A way you can use the piping method is if you want to pass them from one server to another as described in the manpage using the sister command debconf-get-selections which is available in debconf-utils:
debconf-get-selections | ssh anotherserver debconf-set-selections
The temporary file where debconf-set-selections stores them is:
/var/cache/debconf/config.dat
You can check inside and it should contain the settings you just set:
Name: postfix/mailname
Template: postfix/mailname
Value: your.hostname3.com
Owners: postfix
Flags: seen
Name: postfix/main_mailer_type
Template: postfix/main_mailer_type
Value: Internet Site
Owners: postfix
Flags: seen
Then just run the installer and there will be no prompts:
apt install postfix -y
Now if you uninstall postfix:
apt remove postfix --purge
You will notice that there are no more postfix settings at all in /var/cache/debconf/config.dat at all, so if you decide to re-install postfix, and don't run debconf-set-selections again before, you will get the usual prompts.
main_mailer_type? Is there a list to reference somewhere without having to run it interactively once first? – beporter Jun 24 '15 at 21:06No configuration,Internet site,Internet with smarthost,Satellite system,Local onlyhowever it seems like Internet Site is generally the best choice for most people: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=450787 – willbradley Jan 09 '16 at 20:16man debconf-set-selections, I see there's alsodebconf-get-selectionswhich dumps what selections have been made on the current system, in the format used for input here. You could manually setup one system, then just run that to see what to use for kerberos. – morganwahl May 06 '19 at 00:36debconf-get-selectionsin Ubuntu 20.04 – gene_wood Feb 18 '21 at 05:55-o DPkg::Lock::Timeout=-1in addition to-y. – Utkonos Nov 02 '22 at 22:02