Обсуждение: Win XP Install README

Поиск
Список
Период
Сортировка

Win XP Install README

От
Seth Rubin
Дата:
To: Jason Tishler
CC: Postgresql mailing list

Besides being a developer, business owner, etc., I also do tech writing.

I took the latest cygwin postgresql-7.3.3.README and made a few minor
revisions based on what I had to do to make postgresql work with my XP Home
edition, and based on your and Frank Seesink's posts.  Hopefully this should
result in fewer redundant queries from those installing on WinXP.

Rather than make it "perfect", I just added a few tweaks that should:
1 - make it easy to compare to the original (you're busy enough already)
2 - make a complete XP installation possible without resorting to archives
or emailing this list

The revised README follows my signature.  I've also attached it in case your
email client renders it unusable.  Here are the revisions I made:

-- Added footnote "[13]" to item 2 (creating the postgres account)

   [13] Where necessary, grant Postgres access to cygwin's /tmp and /usr/bin
files.
        E.g.
          $ chmod 777 /tmp
          $ chmod a+rx /usr/bin /usr/bin/*

-- Under footnote [12], the one about ntrights under XP Home, added:

       Usage: ntrights -u postgres +r SeServiceLogonRight

-- Added footnote "[14]" to item 8 (Initialize postgresql from postgres
account)

   [14] Do not use "Switch User" to change accounts - log out completely and
     then log back in.  This avoids Windows bug in Terminal Services.

-- Added footnote "[15]" to item 9 (start postmaster):

   [15] If postmaster service fails to start, examine
/var/log/postmaster.log

-- Added footnote "[16]" to item 10 (Connect to PostgreSQL):

   [16] For cygwin 1.3.22-1 and below, a bug prevents this from working
     from accounts other than "postgres".  You can work around this using
     TCP/IP connection (instead of default AF_UNIX) or replacing your
     /usr/bin/cygwin1.dll file with recent .dll snapshot from
     http://cygwin.com/snapshots (unpack with bunzip2)

-- Changed "The following is the basic Cygwin PostgreSQL installation
procedure:",
   to:
       Manual Cygwin PostgreSQL installation procedure:
       (skip for recommended NT services Cygwin PostgreSQL installation)

   This last wasn't strictly necessary, but I noticed that there were
others, beside myself,
   who followed the basic procedure, then hit ourselves for not realizing
the "real"
   procedure was after it.


Hope this all makes your (and everybody else's) life a bit easier.

-- Seth Rubin
   ThoughtProcess Technology LLC


-------------------------------------------------------
Revised /usr/doc/Cygwin/postgresql-7.3.3.README follows
-------------------------------------------------------

$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.

Manual Cygwin PostgreSQL installation procedure:
(skip for recommended NT services Cygwin PostgreSQL installation)

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] [13]
    # 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 [14]

9. Start postmaster:

    # net start postmaster # [7] [15]

10. Connect to PostgreSQL:

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

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.
     Usage: ntrights -u postgres +r SeServiceLogonRight
[13] Where necessary, grant Postgres access to cygwin's /tmp and /usr/bin
files.
     E.g.
        $ chmod 777 /tmp
        $ chmod a+rx /usr/bin /usr/bin/*
[14] Do not use "Switch User" to change accounts - log out completely and
     then log back in.  This avoids Windows bug in Terminal Services.
[15] If postmaster service fails to start, examine /var/log/postmaster.log
[16] For cygwin 1.3.22-1 and below, a bug prevents this from working
     from accounts other than "postgres".  You can work around this using
     TCP/IP connection (instead of default AF_UNIX) or replacing your
     /usr/bin/cygwin1.dll file with recent .dll snapshot from
     http://cygwin.com/snapshots  (unpack with bunzip2)

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-CX
X --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>

Вложения

Re: Win XP Install README

От
Jason Tishler
Дата:
Seth,

On Tue, Jul 08, 2003 at 02:04:35PM -0400, Seth Rubin wrote:
> Besides being a developer, business owner, etc., I also do tech
> writing.

Since you do tech writing...

> Rather than make it "perfect", I just added a few tweaks that should:

Why not make it "perfect?" :,)

> I took the latest cygwin postgresql-7.3.3.README and made a few minor
> revisions based on what I had to do to make postgresql work with my XP
> Home edition, and based on your and Frank Seesink's posts.  Hopefully
> this should result in fewer redundant queries from those installing on
> WinXP.

Just for the record and the archives, does PostgreSQL run properly as a
service under XP Home?

> 1 - make it easy to compare to the original (you're busy enough
> already)

I would have preferred a patch instead:

    $ cp /usr/doc/Cygwin/postgresql-7.3.3.README postgresql-7.3.3.README.orig
    $ # edit postgresql-7.3.3.README
    $ diff -up postgresql-7.3.3.README.orig postgresql-7.3.3.README >postgresql-7.3.3.README.diff

> [snip]
> -- Added footnote "[13]" to item 2 (creating the postgres account)
>
>    [13] Where necessary, grant Postgres access to cygwin's /tmp and
>    /usr/bin files.
>         E.g.
>           $ chmod 777 /tmp
>           $ chmod a+rx /usr/bin /usr/bin/*

I will add the above to the next version of the README.

> -- Under footnote [12], the one about ntrights under XP Home, added:
>
>        Usage: ntrights -u postgres +r SeServiceLogonRight

Ditto.

> -- Added footnote "[14]" to item 8 (Initialize postgresql from
> postgres account)
>
>    [14] Do not use "Switch User" to change accounts - log out
>    completely and then log back in.  This avoids Windows bug in
>    Terminal Services.

The above is no longer necessary.  cygipc now supports Fast User
Switching.

> -- Added footnote "[15]" to item 9 (start postmaster):
>
>    [15] If postmaster service fails to start, examine
> /var/log/postmaster.log

I will add the above to the next version of the README.

> -- Added footnote "[16]" to item 10 (Connect to PostgreSQL):
>
>    [16] For cygwin 1.3.22-1 and below, a bug prevents this from working
                              ^^^^^^^^^
>      from accounts other than "postgres".  You can work around this
>      using TCP/IP connection (instead of default AF_UNIX) or replacing
>      your /usr/bin/cygwin1.dll file with recent .dll snapshot from
>      http://cygwin.com/snapshots (unpack with bunzip2)

The "and below" is not quite correct.  This problem was introduced in
1.3.21 or one or two point releases earlier.  Hence, there is only a
"small" when this doesn't work.

I will add a modified version of the above to the next version of the
README.

> -- Changed "The following is the basic Cygwin PostgreSQL installation
> procedure:",
>    to:
>        Manual Cygwin PostgreSQL installation procedure:
>        (skip for recommended NT services Cygwin PostgreSQL installation)
>
> This last wasn't strictly necessary, but I noticed that there were
> others, beside myself, who followed the basic procedure, then hit
> ourselves for not realizing the "real" procedure was after it.

Ditto.

> Hope this all makes your (and everybody else's) life a bit easier.

It should.  I really appreciate your help.

Thanks,
Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6