Thread: Regarding installing & starting Postgres on Windows

Regarding installing & starting Postgres on Windows

From
"Vikram Patil"
Date:

Hello ,

 

               I am trying to find a way to install PostgreSQL through my script/code . I don’t want to use installer provided on websites.

I compiled source and and I installed in one directory , Now I am trying to register it as a service or start database server directly.

I read in FAQs that I can start database server by revoking administrative rights.  But how I can do that is not mentioned there.

 

Basically I am trying to create similar experience like installer . Please provide some idea on this issue.

Thank you very much in advance .

 

Regards,

Vikram

Re: Regarding installing & starting Postgres on Windows

From
John R Pierce
Date:
Vikram Patil wrote:
>
> Hello ,
>
> I am trying to find a way to install PostgreSQL through my script/code
> . I don’t want to use installer provided on websites.
>
> I compiled source and and I installed in one directory , Now I am
> trying to register it as a service or start database server directly.
>
> I read in FAQs that I can start database server by revoking
> administrative rights. But how I can do that is not mentioned there.
>


create a Windows account specifically to run the server. this account
needs RunAsService privilege (or whatever thats called), and needs 'full
control' over the postgres DATA directory and its contents.

you can create the service something like this from a CMD shell, so I'm
sure you can migrate this to your installer's setup script methods...

NET USER Postgres xyzzy
\path\to\pg_ctl register -N PGSQL-8.3 -U Postgres -P xyzzy -D
\oath\to\pg\data
runas /user:Postgres "\path\to\initdb -D \path\to\data -E locale"


note that this Postgres user account needs to have full access to the
data directory (which it will create if it doesn't exist, in which case,
it needs write access to the parent dir)

I don't quite know the command line magic to grant that process 'Log On
As a Service' privileges, however.