wiki:UsersWikiWinCompileInitdb

Version 39 (modified by pracine, 12 years ago) (diff)

--

Initialize PostgreSQL cluster and run as server for compiled version

This is still a work in progress (Back to windows compile)

  1. Create a Windows local user called "postgres".
  1. Initialize the DB cluster from the Msys shell:

/c/postgres/bin/initdb -U postgres -D /c/postgres/data -A trust

  1. You may want to change the port in the C:/postgres/data/posgresql.conf file (in our case running under 8433 not to conflict with our regular postgres install)
  1. Start PostgreSQL following one of those two options:

Option A) As a Windows service:

1) Install the service: (from a DOS shell not MinGW) (Note that in this case postgres is a windows account so use the password you specified for the windows account.)

"c:\postgres\bin\pg_ctl" register -N "pgsql-8.4 test" -D "C:\postgres\data" -U postgres -P "somepassword"

2) Start the "pgsql-8.4 test" Services from "Configuration Panels->Administration Tools->Services"

If the service does not start, check the Windows Event Viewer for meaningfull error message

3) You can uninstall the service with:

"c:\postgres\bin\pg_ctl" unregister -N "pgsql-8.4 test"

This requires a restart. A faster way is to stop the service and then from dos:

sc delete "pgsql-8.4 test"

Option B) Directly from the DOS shell:

1) In the same shell where you Initialized the DB cluster, do:

"c:\postgres\bin\pg_ctl" -o "-p 5433" start -D C:\postgres\data

2) You can stop the server with:

"c:\postgres\bin\pg_ctl" stop -D C:\postgres\data

3) You can restart the server with:

"c:\postgres\bin\pg_ctl" -o "-p 5433" restart -D C:\postgres\data

  1. Before you do a make check for PostGIS, make sure to do an export of PGPORT and other variable to point to the one you are testing (you do this in Msys)

http://www.postgresql.org/docs/8.4/interactive/libpq-envars.html

These are only good for the current session

export PATH="/c/postgres/bin:$PATH"

export PGPORT=8433

export PGUSER=postgres

to see path settings or any other variables at msys prompt

echo ${PATH}