This document is for those poor souls who wish to install postgres on Windows NT
(I am not 100% sure about 95, 98, or 2K). After spending a few hours (each day) and
needing to install this on over 15 different NT 4.0 machines (don't ask), I
came to the conclusion that a new document was in order. The information in this
document came from various sources primarily from the cygwin32 projects page
(http://www.cygnus.com) and the postgres home pages (http://www.postgresql.org).
Just looking for win32 port information won't cut it for cygwin beta 20.
Anyway to achieve the goal of typing
bash$ sh configurebash$ makebash$ make install
Software requirements:
Prerequisite: Postgresql requires cygwin32_ipc-1.03.tar.gzhttp://www.cygnus.com ./configure should test that this package is already installed, otherwiseit complains that gcc is not able to produce executable!!
Prerequisite: You will also need the Cygwin32 IPC package by Ludovic LANGE.http://www.multione.capgemini.fr:80/tools/pack_ipc/current.tar.gz(This may be optional if you have other professional unix ipc tools installed
)
Prerequisite: The crypt() function is used in PostgreSQL, but it's required library,libcrypt.a, is not in the Cygwin b20 distribution. You will have to download this.You can get a libcrypt-cygwin-b20.1.tar.bz2 only from ftp://sourceware.cygnus.com/pub/cygwin/xfree
Optional: Update to EGCS 1.1.2.
Optional: Download the Andy Piper tools.http://www.xemacs.freeserve.co.uk
Download the current version of PostgreSQL. http://www.postgresql.org
Required software installation process:
Cygwin32-beta20 - follow installation instructions
(It's self extracting
)Note: The Cygnus bin directory has to be placed in the path before the NTdirectories, because the sort.exe has to be taken from Cygnus, not NT.
Cygwin32 IPC - untar the package and follow the readme instructions
Note: you might want to put the library, header files, etc. in the sameLib and include directories that were created by the Cygwin install.
libcrypt.a - untar and follow the compilation directions.Note: you might want to put the library, header files, etc. in the sameLib and include directories that were created by the Cygwin install.
EGCS - follow the instructions
Andy Piper tools - follow the instructions
(Do you see the trend
)
Now, to actually install the software:
1) Unzip and untar postgres.
2) Copy the files from \src\win32 according to the readme file.
3) You will need to create a file in backend/port/tas/ called dummy.s.You must write your own dummy.s. This one has been suggested:
/===========================================================================
== / tas.s -- test and set lock for cygwin
/===========================================================================
==
.file "tas.s" .text .align 16 .globl tas tas: ret /return
[ It sure would be nice if this file or something like it went into the distribution permanently
]
4) Edit src/template/cygwin32 if needed (some have to change the YFLAGS path).You will most likely need to change the paths in the template from /usr/local/lib and /usr/local/include/sys to those set in you Cygwin install. Theseare typically /cygwin-b20/h-i586-cygwin32/i586-cygwin32/lib and /cygwin-b20/h-i586-cygwin32/i586-cygwin32/include/sys respectively.
5) cd /postgresql-6.5.2/src.
6) ./configure
If you have a problem with the script not executing properly
Check that MAKE_MODE is
set to UNIX otherwise 'if' shell command will try to execute cmd.exe but
not /bin/sh 'if' shell. PS-If you had properly installed Cygwin
Solution: bash$ export MAKE_MODE=UNIX
7) make
8) Create the directory /usr/local/pgsql manually: the mkdir cannot create a directory 2levels deep in one step.
9) make install
10) cd ../doc
11) make install
12) Set the environmental data.
13) initdb --username=jkr (Initializing the database; do not run this as administrator.)If you get complaints about USER not being set or you did not run the scripts from thePostgres account, you should clean the system (deleting the install directory and callingmake clean in the src directory. Create the account and start over.
If you have problems with the account about not being able to be recognized as a valid userby initdb after the command prompt, then you establish users in the Cygwin environment. Thisis different depending upon what type of OS you have (95, NT, 98, or 2000
) Look to the Cygwin project home pages for further information.
14) Open a new Cygwin command prompt.
15) Start "ipc-daemon&" (background process).
16) Start "postmaster -I 2>&1 > /tmp/postgres.log &" (background process)
By default, PostgreSQL client like psql communicate by default using unix domain sockets,which do not work on NT. Start the postmaster with -I, and when connecting to the databasefrom a client, set the PGHOST environment variable to 'localhost' or supply the hostname on the command line.
17) Start "tail -f /tmp/postgres.log" to see the messages.
18) cd /usr/src/pgsql/src/test/regress
19) make all runtest
Lyle
PS-If you had not guessed, the 15 installations went well on NT 4.0 SP 3/4.