Installing PostgreSQL 17 on Windows

Introduction

This article shows how to install PostgreSQL 17 on Windows

Downloading

At the time of writing, the versions for Windows are provided through the company EDB

Download link

This article uses version 17.14.1

Installation

17

Run the installer file postgresql-17.14-1-windows-x64.exe with administrator privileges

Choose Run as administrator

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Next >

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Next >

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Next >

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Choose the data directory. For a small amount of data you can leave it unchanged. If you expect a lot of data, it is better to allocate a separate disk for it. then click Next >

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Enter the password for the server

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Choose the port

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Choose the Locale

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Next >

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Next >

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Wait for the installation to finish

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

Installing PostgreSQL 17

Installing Postgres 17, www.aredel.com image from www.aredel.com
Installation
https://aredel.com

pgAdmin

After installation you can connect to the new server with pgAdmin

Wait for it to start; the first time it may take a couple of minutes

First launch of pgAdmin for Postgres 17, www.aredel.com image from www.aredel.com
pgAdmin
https://aredel.com

Servers

First launch of pgAdmin for Postgres 17, www.aredel.com image from www.aredel.com
pgAdmin
https://aredel.com

Enter the password you created during installation and click OK

First launch of pgAdmin for Postgres 17, www.aredel.com image from www.aredel.com
pgAdmin
https://aredel.com

Expand Databases

First launch of pgAdmin for Postgres 17, www.aredel.com image from www.aredel.com
pgAdmin
https://aredel.com

Make sure the postgres database is there

First launch of pgAdmin for Postgres 17, www.aredel.com image from www.aredel.com
pgAdmin
https://aredel.com

Check the version

To check the version of the installed PostgreSQL, go to

C:\Program Files\PostgreSQL\17\bin

And run

.\psql -V

psql (PostgreSQL) 17.8

Configuration after installation

Go to the directory that you specified as the Data Directory and edit the files there pg_hba.conf

host all all 0.0.0.0/0 md5 host all all ::0/0 md5

And postgresql.conf

listen_addresses = '*'

Restart Postgres as follows:

Open

Control Panel → Administrative tools → Services

Find there postgresql-x64-17 right-click it and choose Restart

Restarting the Postgres 17 service in Windows, image from www.eth1.ru

Restarting PostgreSQL

Add Postgres to PATH

Several examples of adding the path to psql to PATH.

In my case psql.exe is in the folder C:\Program Files\PostgreSQL\17\bin

In WSL

PATH=$PATH:/mnt/c/Program\ Files/PostgreSQL/17/bin

In Git Bash

PATH=$PATH:/c/Program\ Files/PostgreSQL/17/bin

In PowerShell you can check whether the path to Postgres is present using Select-String

echo $Env:Path | Select-String Postgres

You can add the path to Postgres to the end of Path as follows

$Env:Path += ';C:/Program Files/PostgreSQL/17/bin'

Add to the beginning of Path

$Env:Path = ';C:/Program Files/PostgreSQL/17/bin' + $Env:Path

Article author: Andrei Olegovich