PostgreSQL Install on Windows

1. Download

Download an appropriate installer from here.

2. Install

Installation instructions can be found here.

3. Post Install

3.1. Configure For Remote Access

3.1.1. Configure Firewall

  1. Open default port 5432 for PostgreSQL.

  2. Run the netsh command.

If you specified a custom port in the previous statement, you should specify that value here too as the localport value.

netsh advfirewall firewall add rule name = PostgreSQL dir = in protocol = tcp action = allow localport = 5432 remoteip = localsubnet profile = DOMAIN (1)
1 this is the netsh command to open the firewall

3.1.2. Configure Host Based Authentication

Edit the pg_hba.conf file. This file will be located in the Data Directory you chose during this step of the configuration:

Install-DataDirectory

Add the following to accept connections from all hosts on the network 192.168.1.XXX:

host	all 			all 			192.168.1.1/24 			scram-sha-256

Restart PostgreSQL.

Restart-PostgreSQL