Home Page

 

Computers

 

Developer

 

Since I could not make PostgreSQL work under Cygwin this time, here is another solution:

http://forums.devshed.com/t159166/s.html mentions http://pgfoundry.org/projects/pginstaller/ project, which is a native Windows port of PostgreSQL, version 7.5. There is a development version available. During installation, it is needed to do the following:

Set the following environment variables:

And below are the instructions on installing under Cygwin, just in case. I must mention that the solution below did not work for me!


How to install PostgreSQL as a service on Windows, with CygWin

Postgres 7.4.3, Windows XP SP1

  1. Install CygWin from the Internet
  2. Add Cygwin's bin directory to Windows PATH
  3. run /usr/bin/cygserver-config script to install the cygwin server
  4. add system environment variable Cygwin=server;ntsec to Windows, or in /cygwin.bat (set CYGWIN=server).
  5. Add
    set PGDATA=c:\programs\cygwin\usr\local\pgsql\data
    to cygwin.bat
  6. start cygserver service on Windows
  7. create "postgres" user account
    # net user postgres $password /add /fullname:postgres /comment:'PostgreSQL user account' /homedir:"$(cygpath -w /home/postgres)"
    # mkpasswd -l -u postgres >>/etc/passwd
  8. grant "postgres" user "Log on as a service" user right:
    # cmd /c secpol.msc
  9. install postmaster as a service:
    # cygrunsrv --install postmaster --path /usr/bin/postmaster --args "-D /usr/local/pgsql/data -i" --dep cygserver --termsig INT --user postgres --shutdown
  10. Create the PostgreSQL data directory:
    # mkdir -p /var/postgresql/data
  11.  Change ownership of the PostgreSQL data directory:
    # chown postgres /usr/local/pgsql/data
  12. Start cygserver:
    # cygrunsrv -S cygserver
  13. Initialize PostgreSQL (as the "postgres" account; ssh to localhost as 'postgres'):
    $ initdb -D /usr/local/pgsql/data
  14. Start postmaster:
    # cygrunsrv -S postmaster
    or through Services window.
  15. Verify postmaster is running:
    # cygrunsrv -Q postmaster
  16. Connect to PostgreSQL:
    # psql -U postgres template1