I have included Postgres in a custom installer for a Windows application. I do not use the installer binary, but extract the Postgres zip archive for installation and then run initdb from a batch script.

After installation, the db cluster should accept connections from everywhere. Currently my installation routine

  1. modifies pg_hba.conf
  2. creates a firewall rule

Problem: I don't know how make the installation routine configure postgresql.conf so that listen_addresses is set to the right value:

listen_addresses = '*'

Currently this has to be done manually. I didn't find a parameter in initdb that does this.

Question: Is there any way to automate the installation process so that listen_addresses is configured as needed? Can this be done using initdb?


The easiest solution is to append:

listen_addresses = '*'

to postgresql.conf after running initdb. As the last occurrence overrides earlier ones, this would even apply if the default entry were commented out.

Db cluster has to be restarted/reloaded after that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.