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:
- create a user account for PostgreSQL server to use, i.e. postgres/postgres
- give it the right to "Log on as a service": > cmd /c secpol.msc
you can test the account with > runas /noprofile /user:postgres cmd
Set the following environment variables:
- Add Bin and Lib paths i.e. "C:\postgres\bin" and "C:\postgres\lib".
- Add Data path - "PGDATA" as the variable name, and "c:\postgres\data" as
the variable value.
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
- Install CygWin from the Internet
- Add Cygwin's bin directory to Windows PATH
- run /usr/bin/cygserver-config script to install the cygwin server
- add system environment variable Cygwin=server;ntsec to Windows, or in
/cygwin.bat (set CYGWIN=server).
- Add
set PGDATA=c:\programs\cygwin\usr\local\pgsql\data
to cygwin.bat
- start cygserver service on Windows
- 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
- grant "postgres" user "Log on as a service" user right:
# cmd /c
secpol.msc
- 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
- Create the PostgreSQL data directory:
# mkdir -p /var/postgresql/data
- Change ownership of the PostgreSQL data directory:
# chown postgres
/usr/local/pgsql/data
- Start cygserver:
# cygrunsrv -S cygserver
- Initialize PostgreSQL (as the "postgres" account; ssh to localhost as
'postgres'):
$ initdb -D /usr/local/pgsql/data
- Start postmaster:
# cygrunsrv -S postmaster
or through Services
window.
- Verify postmaster is running:
# cygrunsrv -Q postmaster
- Connect to PostgreSQL:
# psql -U postgres template1