Next Previous Contents

27. PostgreSQL Port to Windows 95/Windows NT

PostgreSQL binaries for Windows NT is available from :

Download the binaries and unpack and follow instructions in Install PostgreSQL from step 13.

If you want to re-compile the source tree then follow the instructions given below. Porting to NT is done using Cygnus cygwin32 package which has gcc, gmake for Win NT/95.

At this site and get the file cdk.exe (self-extractor file for gnu-win32)

27.1 Authors of NT port

The authors of Windows NT port of PostgreSQL are -

27.2 Install the Cygwin package

  1. Download ftp://go.cygnus.com/pub/sourceware.cygnus.com/cygwin/latest/full.exe
  2. Run full.exe and install in c:\Unix\Root directory.
  3. Run Cygwin, Type 'mount --help' for docs. You can use -f switch to force mount. And then run "umount / " and "mount c:\Unix\Root /"

27.3 Tuneup Bash Window

After installing the Cygwin package, do the following to setup the working environment:

1. Install the Vi editor 'Vim'. See http://metalab.unc.edu/LDP/HOWTO/Vim-HOWTO.html

2. The default window of cygwin bash is black-background window with 24 lines. To set the background color and size of bash window, click on NT-Start->Control-panel->MS DOS console and change the background color to grey and size to 70 lines.

(OR) right click on Window titlebar and change property.

3. Edit cygnus.bat in c:\cygnus\cywinb20 and set the following -


set HOME=c:\cygnus\cygwinb20
bash --login

And also edit the  /.bash_profile and put these lines


set -o vi
PATH=$PATH:/usr/local/bin:/usr/bin
export PATH

4. To enable the command-line history editing give -

bash$ set -o vi

Using the l,k,j,h you can use the vi commands to edit the command line history commands. You can repeat or modify previous commands, saves typing time.

5. You can do mount of drives/directories using this command -


bash$ umount /
bash$ mount "c:\cygnus"  /
bash$ mount "c:\cygnus\cygwin-b20\postgres" /usr/local/pgsql

6. See online help with -


bash$ mount --help
bash$ ls --help

27.4 Install the Andy Piper tools

  1. Go to ftp://ftp.xemacs.org/pub/xemacs/aux/ and download cygwin-b20-local.tar.bz2 in the c:/Unix/Root directory.
  2. cd c:/Unix/Root; bunzip2 cygwin-b20-local.tar.bz2
  3. tar -xvf cygwin-b20-local.tar
  4. cd /local/bin; sh check_cygwin_setup.sh
  5. After doing step 4, you see the following message:
    You don't have /bin would you like to mount cygwin as /bin?" 
    [ y/n ]   
    Select 'n',  and the other options are selected 'y' 
    

  6. mount c:/Unix/Root/cygwin-b20/H-i586-cygwin32/i586-cygwin32/bin /bin
  7. cd c:/Unix/Root/cygwin-b20/H-i586-cygwin32/i586-cygwin32; mkdir libexec share man etc sbin info
  8. cp -R /local/{ bin,libexec,share,man,etc,sbin,info,include }

27.5 Install Ludovic Lange's Cygwin32 IPC package

  1. Go to http://www.multione.capgemini.fr/tools/pack_ipc and download cygwin32_ipc-1.03.tgz in c:/Unix/Root directory.
  2. tar -zxvf cygwin32_ipc-1.03.tgz
  3. cd cygwin32_ipc-1.03/src and run 'make'
  4. mkdir -p c:/usr/local/{bin,include,lib,include/sys}
    cp /cygwin32_ipc-1.03/bin/* c:/usr/local/bin 
    cp /cygwin32_ipc-1.03/include/sys/* c:/usr/local/include/sys 
    cp /cygwin32_ipc-1.03/lib/* c:/usr/local/lib 
    cp c:/usr/local/bin/* /bin 
    cp c:/Unix/Root/cygwin-b20/H-i586-cygwin32/bin/* /bin 
    

  5. mount c:/usr/local/bin /usr/local/bin
    mount c:/usr/local/include /usr/local/include 
    mount c:/usr/local/lib /usr/local/lib 
    cp /local/lib/* /usr/local/lib 
    

27.6 Install PostgreSQL

  1. Download the latest PostgreSQL source code
  2. Postgres treats all files as binary files so the lf/cf stuff appeard, so we do steps 2, 3, 4, and 5:
    mkdir -p c:/Postgres/{Source,Binary} 
    mkdir c:/Postgres/Binary/pgsql 
    mkdir -p /usr/src/pgsql 
    mkdir -p /usr/local/pgsql 
    

  3. Copy Postgres source code to c:/Postgres/Source directory, then tar -zxvf postgresql-6.5.3.tar.gz
  4. mv postgresql-6.5.3 pgsql
  5. Mount directories now -
    mount -b c:/Postgres/Binary/pgsql /usr/local/pgsql 
    mount c:/Postgres/Source/pgsql /usr/src/pgsql 
    mount c:/Unix/Root/cygwin-b20/share /sw/cygwin-b20/share 
    

  6. mkdir -p /usr/local/pgsql/{bin,include,lib,data}
  7. cd /usr/src/pgsql/src/win32
  8. Copy header files -
    cp un.h c:/Unix/Root/cygwin-b20/H-i586-cygwin32/i586-cygwin32/include/sys 
    cp endian.h c:/Unix/Root/cygwin-b20/H-i586-cygwin32/i586-cygwin32/include 
    cp tcp.h c:/Unix/Root/cygwin-b20/H-i586-cygwin32/i586-cygwin32/include/netinet 
    

  9. ln -s /usr/local/lib /usr/src/pgsql/src/backend/libpostgres.a
  10. cd /usr/src/pgsql/src, then run './configure'
  11. make > make.txt 2>&1
  12. make install > make.install.txt 2>&1
  13. cp /usr/local/pgsql/lib/pq.dll /usr/local/pgsql/bin
  14. After the make install you had to change all the text files in the bin and lib diectories so that they did not contain cr/lf and eof stuff.
  15. Using any editor to create .bashrc in / directory as belows:
    PATH=$PATH:/usr/local/pgsql/bin:/usr/local/bin 
    PGDATA=/usr/local/pgsql/data 
    PGLIB=/usr/local/pgsql/lib 
    LD_LIBRARY_PATH=/usr/local/pgsql/lib:/usr/local/lib 
    export LD_LIBRARY_PATH PATH PGDATA PGLIB 
    

  16. source /.bashrc, then run 'initdb --username=xxxx' Note that the owner of the DB system have to be different from root/administrator
  17. Edit the file /usr/local/pgsql/data/pg_hba.conf, such as:
    host        all     163.17.11.109   255.255.255.0   trust 
    

  18. ipc-daemon.exe&
  19. postmaster -i&
  20. Run ' psql -h host_name template1'

Next Previous Contents