This post is the next in a short series exploring the different ways we can install a PostgreSQL server. This time, we’ll look at a vanilla install on Windows – no Docker involved.
The VM
I’ll use the same spec VM as in the last post, which is sufficient for demonstration purposes:
- Windows Server 2022
- 8-Core CPU
- 8GB RAM
Firstly, let’s hop over to the PostgreSQL download page and choose the Windows installer. The latest and greatest version at the time of writing is 18.4. The download page took me to enterprisedb.com and downloaded an installation .exe file.
The setup is fairly straightforward, so let’s walk through it:
Firstly, just a welcome splash screen:

Next we choose the directory where we want the binaries to be installed. I will leave the default in this case:

Then we get a choice of components to install. I’ll just install the server with the command line tools:

Now we choose where we want our actual PostgreSQL cluster to be installed. I will leave the default, which is a sub-directory of the main installation directory:

Next we choose a password for the PostgreSQL superuser that the installation will create:

Now we choose the port, which again I will leave at the default of 5432:

Finally, I’ll choose the default locale:

We now get an installation summary, confirming what is about to happen:

Now we get a progress bar like we have become so accustomed to seeing, as the installer does the business:

After a few minutes of the progress screen, we are greeted with a confirmation of success:

Connect
As per the previous post, we are using a Windows host and so the Defender Firewall will block inbound connections unless we set a rule to allow them. We can do this in PowerShell with:
New-NetFirewallRule -Name postgres -DisplayName postgres -Direction Inbound -Action Allow -LocalPort 5432 -Protocol TCP
If I then try to connect via pgAdmin from a remote machine, I get this error:

This error, whilst a slightly different error message to the one we saw at this point on the Linux install, is quite clearly telling us what the issue is. Whereas on Linux, the setting listen_addresses = ‘*’ was not present in postgresql.conf, it is on Windows. We can verify this with the PowerShell command below:
Select-String -Path "C:\Program Files\PostgreSQL\18\data\postgresql.conf" -Pattern "listen_addresses"

However, like Linux, on our new Windows installation, we do not have a default host-based authentication rule that allows us to connect. As a reminder, this part of the configuration is already taken care of for us on Docker.
If we open the pg_hba.conf file @ C:\Program Files\PostgreSQL\18\data\ we can add the relevant rule. I’ll add the same rule we added in the Linux install, allowing all clients to connect with a username and password:
host all all 0.0.0.0/0 scram-sha-256
Once the file is saved, we can restart the service:
Get-Service -Name "postgresql-x64-18" | Restart-Service
Now if I try the connection from pgAdmin on the remote machine again, we can see the familiar dashboard that opens with pgAdmin. With that, we have successfully connected:

References / Further Reading
DualCoreDBA – Four Flavours of Postgres Install – Part 1
DualCoreDBA – Four Flavours of Postgres Install – Part 2
DualCoreDBA – Four Flavours of Postgres Install – Part 3
The PostgreSQL Global Development Group – Authentication Methods
