Download binaries from https://www.enterprisedb.com/download-postgresql-binaries, unzip them into a directory of your choice, add that path to environment variable & create the database using initdb
found in the bin subdirectory:
> initdb -D {path} -U postgres -W -E UTF8 -A scram-sha-256
> initdb -D c:\local\var\data -U postgres -W -E UTF8 -A scram-sha-256
This will create the PostgreSQL data directory in the given path.
-U postgres creates the superuser as postgres
-W will prompt you for the password of the superuser
-E UTF8 will create the database with UTF-8 encoding
-A scram-sha-256 enables the password authentication
> pg_ctl -D {path} -l {path} start
> pg_ctl -D c:\local\var\data -l c:\local\var\log\postgresql.log start
> pg_ctl -D {path} stop
> pg_ctl -D c:\local\var\data stop
Register
> pg_ctl register -N PostgreSQL -D {path}
> pg_ctl register -N PostgreSQL -D c:\local\var\data
Unregister
> pg_ctl unregister -N PostgreSQL