Postgres Cygwin Install-as-Service on XP Pro/Home Mini HOWTO

Поиск
Список
Период
Сортировка
От Kevin Wong
Тема Postgres Cygwin Install-as-Service on XP Pro/Home Mini HOWTO
Дата
Msg-id 3DC76EA4.7090503@usa.net
обсуждение исходный текст
Ответы Re: Postgres Cygwin Install-as-Service on XP Pro/Home Mini  (Jason Tishler <jason@tishler.net>)
Список pgsql-cygwin
Windows XP Home and Professional behave slightly different, compared to Windows NT/2000, especially on issues of
servicesand security models.  Therefore, the original instructions for installing postgres as a service don't quite
workwith XP Home or Pro.<br /><br /> Here's what I've learned so far, which may be of great help to those struggling
withthe same problem.<br /><br /><b>Windows XP Professional:</b><br /><br /> I haven't tried Postgres on Cygwin for XP
Promyself yet, but I believe that you just need to follow all of the instructions in the
/usr/doc/Cygwin/postgresql-X.X.X-Readmefile, as you would for Windows NT or 2000.<br /><br /> BUT!!!!  Swap Excerpted
Steps7 and 8.  "initdb" won't actually run successfully without ipc-daemon running in the background first, in my
experience.<br/><br /><br /><b>Windows XP Home:</b><br /><br /> Because Windows XP Home has a number of differences
fromXP Pro, primarily in user accounts/management, you can't simply follow the standard NT/2000 install-as-service
instructions. You have to do a few things differently.<br /><br /> In case you're wondering or are confused, the
followingis an excerpt from the /usr/doc/Cygwin/postgresql-7.2.1.README file, which is the additional readme for
Cygwin-specificissues for postgres.  Note all of the standard, non-Cygwin-specific docs are found in
/usr/doc/postgresql-7.2.1.<br/><br /> ***************<br /> BEGIN EXCERPT<br /> ***************<br /><br /> The
followingis the NT services Cygwin PostgreSQL installation procedure:<br /><br /> 1. Install the cygipc ipc-daemon as a
NTservice:<br /><br />     # ipc-daemon --install-as-service<br /><br /> 2. Create the "postgres" user account:<br
/><br/>     # cmd /c lusrmgr.msc # [3]<br />     # mkpasswd -l -u postgres >>/etc/passwd<br /><br /> 3. Grant the
"postgres"user the "Log on as a service" user right:<br /><br />     # cmd /c secpol.msc [4]<br /><br /> 4. Install
postmasteras a NT service:<br /><br />     # cygrunsrv --install postmaster --path /usr/bin/postmaster --args "-D
/usr/share/postgresql/data-i" --dep ipc-daemon --termsig INT --user postgres --shutdown<br /><br /> 5. Create the
PostgreSQLdata directory:<br /><br />     # mkdir /usr/share/postgresql/data<br /><br /> 6. Change ownership of the
PostgreSQLdata directory:<br /><br />     # chown postgres /usr/share/postgresql/data<br /><br /> 7. Initialize
PostgreSQL(*when running under the "postgres" account*):<br /><br />     $ initdb -D /usr/share/postgresql/data<br
/><br/> 8. Start the cygipc ipc-daemon:<br /><br />     # net start ipc-daemon<br /><br /> 9. Start postmaster:<br
/><br/>     # net start postmaster<br /><br /> 10. Connect to PostgreSQL:<br /><br />     # psql -U postgres
template1<br/><br /> *************<br /> END EXCERPT<br /> *************<br /><br /> Compared to the excerpt, XP Home
hasa few differences, again, because of its limited security model.<br /><br /> You must do all of the following from
withina a Cygwin shell, logging into Windows XP Home as an administrative user (any non-guest user), preferably your
normaluser account.  The account that was used to install Cygwin is ideal due to some default filename/permissions that
Cygwinused during installation of itself, and of the postgres package.<br /><br /> I do everything on my machine as
"kwong",so it was a natural choice to log-in as kwong and launch a Cygwin shell under that user id.  That's the user
accountI use in the examples below.  Substitute the appropriate user account for your own installation.<br /><br />
ExerptedStep 1 works just fine.<br /><br /> Excerpted Step 2 and Step 3 don't work at all under XP Home, again due to
limitations. Skip them completely.<br /><br /> Excerpted Step 4 is very close, but doesn't quite work due to some funky
file/directory/loginpermissions.  That's why the discussion above about using the same user that had installed Cygwin
andpostgres to begin with...<br /><br /> So, instead of the command used in Excerpted Step 4, use this:<br /><br /> $
cygrunsrv--install "Cygwin postgres" --path /usr/bin/postmaster --args "-D /usr/share/postgresql/data -i" --dep
ipc-daemon--termsig INT --user kwong --shutdown<br /><br /> Note, I'm assuming (as does the original readme) that
you'regoing to be using "/usr/share/postgres/data" as the data directory for postgres.  Again, note the username used
here. It's best if the user that runs the postgres service is the same one that installed postgres/Cygwin to begin
with. Otherwise, you need to get into lengthy manual permission juggling in the postgres data directories.<br /><br />
ExcerptedSteps 5 and 6 are fine.<br /><br /> Swap Excerpted Steps 7 and 8.  "initdb" won't actually run successfully
withoutipc-daemon running in the background first.<br /><br /> Excerpted Step 9 should be replaced with:<br /><br /> $
netstart "Cygwin postgres"<br /><br /> I named my service a bit differently than in the original instructions, to
bettermatch the naming conventions of other Cygwin services.<br /><br /> Excerpted Step 10 should be replaced with:<br
/><br/> $ psql template1<br /><br /> You don't have to provide the username in launching psql, as we're already
logged-inas the user that created the databases.  Again, this is a limitation of XP Home security. <pre
class="moz-signature"cols="$mailwrapcol">-- 
 
**********

This message is directed in confidence solely to the
person(s) identified.  This message may also be subject to
privilege and all rights to that privilege are expressly
claimed.  If you have received this message in error, please
notify the sender(s) and destroy the message immediately.

**********

Kevin Wong, LL.B
E-Mail:  <a class="moz-txt-link-abbreviated" href="mailto:kevin-wong@usa.net">kevin-wong@usa.net</a>
</pre>

В списке pgsql-cygwin по дате отправления:

Предыдущее
От: Florian Litot
Дата:
Сообщение: Re: trace
Следующее
От: dag@interfree.it ()
Дата:
Сообщение: plpython.dll