Next Previous Contents

21. PostgreSQL Port to Windows 95/Windows NT

Port to Windows NT is done and is available from http://www.postgresql.org. You can download the PostgreSQL binaries for Windows NT from download page and will save you time. 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)

21.1 Authors of NT port

The authors of Windows NT port of PostgreSQL are -

21.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 /"

21.3 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 }

21.4 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 
    

21.5 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