wiki:UsersWikiWinCompileInitdb

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. Change the configurated port

You may want to change the port in the "C:/postgres/data/posgresql.conf" file to something like 8433 in order to avoid conflict with your regular postgres install.

  1. Copy /c/postgres/lib/libpq.dll to /c/postgres/bin. The server may not start because it couldn't find libpq.dll
  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 (prefered option):

1) In the same shell in which you initialized the DB cluster, do:

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

or (to read the port from the postgresql.conf)

"c:\postgres\bin\pg_ctl" 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. Export the configuration variables

Before you do a make check for PostGIS, make sure to export the PATH, PGPORT and PGUSER variables in MSYS. Note that these exports are only valid for the current session. For more information about the PostgreSQL environment variables see http://www.postgresql.org/docs/8.4/interactive/libpq-envars.html

export PATH="/c/postgres/bin:$PATH"
export PGPORT=8433
export PGUSER=postgres

to see path settings or any other variables in the MSYS prompt:

echo ${PATH}

Last modified 15 years ago Last modified on 06/02/10 06:03:30
Note: See TracWiki for help on using the wiki.