• Install Cygwin on NT. Here is a link to cygwin: www.cygwin.com/.

  • The following instructions assume you have correctly installed cygwin and have a cygwin window open. All of the following should be done inside a cygwin window. Cygwin is required for PostgreSQL to run on NT.

  • Install Charles Wilson's Cygwin32 IPC package into cygwin. Here is a link: http://www.neuro.gatech.edu/users/cwilson/cygutils/OBSOLETE/V1.1/cygipc/

  • You can save some time by downloading the binary version, cd to where you saved it, and unpacking it by typing tar zxvf cygipc-1.07-1.tar.gz inside a cygwin window.

  • Start the ipc daemon in cygwin (this must be running for PostgreSQL to work):

  • ipc-daemon &

  • Download and install PostgreSQL on NT. You can download the software from www.postgresql.org. I prefer to link to the source directly via cvs and download the latest version of the code. Here is a web site that explains how: http://www.postgresql.org/devel-corner/docs/postgres/cvs.htm

  • Set up your cygwin for PostgreSQL environment (this assumes you stored PostgreSQL in /usr/local/pgsql).

  • Using a text editor, create ~/.bashrc and include the following lines (i.e. vi ~/.bashrc):
    export PATH=$PATH:/usr/local/pgsql/bin:/usr/local/bin
    export PGDATA=/usr/local/pgsql/data
    export PGLIB=/usr/local/pgsql/lib
    export LD_LIBRARY_PATH=/usr/local/pgsql/lib:/usr/local/lib

  • Initialize PostgreSQL by typing the following in your cygwin window:

  • initdb
    FYI: the owner of the DB system must be different from root/administrator.
    If there are any errors, then fix them before continuing. If PostgreSQL was installed correctly you see a success message.

  • You many need to edit the file /usr/local/pgsql/data/pg_hba.conf to allow computers to access the database. Here is an example:

  • host all 163.17.11.109 255.255.255.0 trust. If you get errors when trying to connect to the database from a different computer, then pg_hba.conf could be causing the problem.

  • Start the PostgreSQL postmaster (this allows user to connect to PostgreSQL):

  • This will send all PostgreSQL messages to the current cygwin window (this is great for debugging, not so good for a production system)
    postmaster -i &

    This will start the PostgreSQL postmaster and send all PostgreSQL messages to c:\
    postmaster -i c:\postgres.log 2&1 &

  • The Postmaster must always be running. You may want to look into starting cygwin and the postmaster as a service on NT.

  • Test PostgreSQL:

  • createdb testdb
    psql testdb
    You should see a PostgreSQL prompt such as "testdb=#"
    \q to exit psql dropdb testdb



Differences between the linux/freebsd version of PostgreSQL and the NT version:

When creating a language you should use a .dll extension rather that a .so extension. For example:

Installing the pl/pgsql language on unix:
CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS
'/usr/local/pgsql/lib/plpgsql.so' LANGUAGE 'C';

Installing the pl/pgsql language on NT:
CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS
'/usr/local/pgsql/lib/plpgsql.dll' LANGUAGE 'C';


More information about PostgreSQL:

Here is the main PostgreSQL site: www.postgresql.org

Here is the on-line documentation for PostgreSQL: http://postgresql.readysetnet.com/devel-corner/docs/postgres/

Here is a great link for new users: http://postgresql.readysetnet.com/users-lounge/index.html