Re: Postgresql on Windows 2000 - Mailing list pgsql-odbc

From Stuart
Subject Re: Postgresql on Windows 2000
Date
Msg-id 3F002F4D.7020503@blueyonder.co.uk
Whole thread Raw
In response to Postgresql on Windows 2000  (Nagaraja Sadar <n_agraj@yahoo.com>)
List pgsql-odbc
Nagaraja Sadar wrote:

> Hi friends am new to this group, rather am new to postgresql please let
> me know where to download and how to install POSTGRESQL on windows 2000
> machine please guys i have to learn it within very less time
>
>
Use cygwin (www.cygwin.com) which has a postgresql binary included
You will also need cygipc from
http://www.neuro.gatech.edu/users/cwilson/cygutils/cygipc/index.html
I've included the cygwin postgresql readme for ease
Also there is a postrgesql on cygwin specific list:
pgsql-cygwin@postgresql.org
hth,
- Stuart

$Id: README,v 1.33 2003/05/19 15:59:54 jt Exp $

Abstract:

This is the README for the Cygwin PostgreSQL distribution.

PostgreSQL is an advanced Object-Relational database management system
(DBMS) that supports almost all SQL constructs (including transactions,
subselects and user-defined types and functions).

The Cygwin PostgreSQL package is very monolithic compared its RPM
counterparts and its contents is roughly analogous to the aggregation
of the following PostgreSQL RPMs:

     postgresql-contrib
     postgresql-devel
     postgresql-docs
     postgresql-jdbc
     postgresql-libs
     postgresql-perl
     postgresql-python
     postgresql-server

Requirements:

The following packages or later are required to build and/or execute
Cygwin PostgreSQL:

     crypt 1.0-1
     cygipc 1.14-1
     cygwin 1.3.16-1
     gcc 3.2-3
     libncurses6 5.2-8
     libreadline5 4.2a-1
     perl 5.8.0-1
     readline 4.2a-1
     zlib 1.1.3-6

     Sun JDK 1.3
     Ant 1.5

Install:

There are two types of Cygwin PostgreSQL installations -- basic and NT
services.  The basic installation is good for casual use on any version of
Windows, but required on Windows 9x/Me.  The NT services installation is
good for a more production environment, but is only available on Windows
NT/2000/XP.  Note that this installation type is very similar to the normal
Unix installation with just some Cygwin/Windows variations.  You should
choose the type which best meets your needs and/or is constrained by your
platform.

Regardless of the installation type, the first step is to install the
latest cygipc from:

     http://www.neuro.gatech.edu/users/cwilson/cygutils/cygipc/index.html

*and* start the cygipc ipc-daemon.  If ipc-daemon is not running or a
version previous to 1.14-1 is running, then initdb and postmaster can
fail with the error message:

     IpcSemaphoreCreate: semget(...) failed: Function not implemented

and

     IpcMemoryCreate: shmget(...) failed: Function not implemented

respectively.  Note with Cygwin PostgreSQL 7.2.3-1 and previous versions,
initdb and postmaster would hang, consuming all available CPU cycles if
ipc-daemon was not running.

The following is the basic Cygwin PostgreSQL installation procedure:

1. Start the cygipc ipc-daemon:

     $ ipc-daemon &

2. Initialize PostgreSQL:

     $ initdb -D /usr/share/postgresql/data

3. Start the PostgreSQL postmaster:

     $ postmaster -D /usr/share/postgresql/data &

4. Connect to PostgreSQL:

     $ psql template1

The following is the NT services Cygwin PostgreSQL installation procedure
(with footnotes designated by "[n]"):

1. Install the cygipc ipc-daemon as a NT service:

     # ipc-daemon --install-as-service

2. Create the "postgres" user account:

     # net user postgres $password /add /fullname:postgres
/comment:'PostgreSQL user account' /homedir:"$(cygpath -w
/home/postgres)" # [11]
     # mkpasswd -l -u postgres >>/etc/passwd

3. Grant the "postgres" user the "Log on as a service" user right:

     # cmd /c secpol.msc # [3] [4] [5] [12]

4. Install postmaster as a NT service:

     # cygrunsrv --install postmaster --path /usr/bin/postmaster --args
"-D /usr/share/postgresql/data -i" --dep ipc-daemon --termsig INT --user
postgres --shutdown # [6]

5. Create the PostgreSQL data directory:

     # mkdir /usr/share/postgresql/data

6. Change ownership of the PostgreSQL data directory:

     # chown postgres /usr/share/postgresql/data # [10]

7. Start the cygipc ipc-daemon:

     # net start ipc-daemon # [7]

8. Initialize PostgreSQL (*when running under the "postgres" account*):

     $ initdb -D /usr/share/postgresql/data

9. Start postmaster:

     # net start postmaster # [7]

10. Connect to PostgreSQL:

     # psql -U postgres template1 # [8] [9]

The following are the notes to the above:

[1] The "#" prompt indicates running as a user which is a member of the
     Local Administrators group.
[2] The "$" prompt indicates running as the "postgres" user.  Log in as
     "postgres" or use ssh to emulate Unix's "su" command.
[3] Sorry, but I don't know of a generally available command line way of
     setting user rights.
[4] On Windows 2000 and XP Pro, this starts the "Local Security Settings"
     applet.  On Windows NT 4.0, start User Manager, select Policies,
and then
     select User Rights...
[5] See http://support.microsoft.com/default.aspx?scid=KB;en-us;q259733 for
     a Microsoft KB article explaining how to configure user rights.
[6] Clean postmaster shutdown will only work with a post Cygwin 1.3.2
     snapshot from 2001-Jul-28 or later.
[7] Cygwin's bin directory (e.g., C:\Cygwin\bin) must be added to the
     Windows NT/2000's system PATH and the machine rebooted for the SCM
     to find cygwin1.dll.
[8] Actually, psql can run under any user account.
[9] One can use PostgreSQL's createuser command or set PGUSER to obviate
     the need to specify "-U postgres" on the psql command line.
[10] Assumes that ntsec is set via the CYGWIN environment variable.
[11] $password is the password for the postgres user account.
[12] On Windows XP Home, there is no built in way to assign user rights
-- use
      ntrights instead.  This tool is available from the Windows 2000
Resource
      Kit or http://www.dynawell.com/reskit/microsoft/win2000/ntrights.zip.

Source:

As configured, the PostgreSQL source builds OOTB under Cygwin.

I also added the following files to the source archive:

     CYGWIN-PATCHES/README
     CYGWIN-PATCHES/build.sh

and renamed the original source archive to match Cygwin's setup.exe
naming conventions.

Build:

This distribution has been configured as follows:

     configure --enable-multibyte --with-python --with-perl --with-java
--with-CXX --prefix=/usr --sysconfdir=/etc
--docdir=/usr/doc/postgresql-$version

where $version is the PostgreSQL version (e.g., 7.3).

See CYGWIN-PATCHES/build.sh in the source archive for my exact build
recipe for configuring, making, and packaging this distribution.

Test:

On NT/2000/XP, Cygwin PostgreSQL passes all regression tests (i.e., make
installcheck).

On 9X/ME, it has been reported that Cygwin PostgreSQL hangs at random
places during the regression test.  Unfortunately, at the time of this
writing, no one has tracked down the root cause of these hangs.

Issues:

1. make check can generate spurious regression test failures due to
overflowing the the listen() backlog queue which generates connection
refused errors.  Note that make installcheck does not have this problem
since it runs all tests sequentially instead of in large concurrent
groups.

2. It is recommended to delete all cygipc temporary files (/tmp/cygipc*
and /tmp/MultiFile*) before starting postmaster under a different user
account.  Otherwise, postmaster will fail to start due to IPC errors.

Homepage:

The primary PostgreSQL web site is:

     http://www.postgresql.org

Download:

The primary PostgreSQL ftp site is:

     ftp://ftp.postgresql.org

Mailing Lists:

Please report problems, suggestions, etc. dependent on their nature to
one of
the following:

     pgsql-cygwin@postgresql.org
     cygwin@cygwin.com

Maintainer:

     Jason Tishler <jason@tishler.net>


pgsql-odbc by date:

Previous
From: Nagaraja Sadar
Date:
Subject: Postgresql on Windows 2000
Next
From: Shachar Shemesh
Date:
Subject: A few problems with the ODBC driver