Обсуждение: new instance of postgres on windows

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

new instance of postgres on windows

От
Arvind Singh
Дата:
Hello and greetings,


I want to install postgresql for use as the backend to a Windows application.


This seems to be no problem if postgresql is NOT already installed on the system. which is not in this case.



postgresql is already installed and  unless the command line parameters contain the superpassword etc of the existing installation , the install fails. As I will likely never know the superpassword or other account details of any pre-existing postgresql instances and the machine owners may not either.


How to then proceed and install a new  instance that can  be used by our application.


Window 7
Postgres 9.3 beta




regards


Re: new instance of postgres on windows

От
raghu ram
Дата:

On Thu, Jul 18, 2013 at 3:52 PM, Arvind Singh <arvindps@hotmail.com> wrote:
Hello and greetings,


I want to install postgresql for use as the backend to a Windows application.


This seems to be no problem if postgresql is NOT already installed on the system. which is not in this case.



postgresql is already installed and  unless the command line parameters contain the superpassword etc of the existing installation , the install fails. As I will likely never know the superpassword or other account details of any pre-existing postgresql instances and the machine owners may not either.


How to then proceed and install a new  instance that can  be used by our application.


Window 7
Postgres 9.3 beta





The password you need to reset is at the operating system level.   To do this on Windows, do the following:

1) Right click on the 'My Computer'  desktop icon  ( or if the icon is not on the desktop, open the start menu and right click on the 'My Computer' menu item)

2) Choose 'Manage' from the pop up menu

3) Expand the 'Local Users and Groups' folder

4) Expand the 'Users' folder

5) On the right hand side of the screen, you will see all the users defined on the system.

6) You can right click on the "postgres" user name and choose 'Set Password' and then change it to something else

OR  You can delete the user and then have the installer recreate the user.

You will need to be logged into the computer as an administrative user to do the above. 

Thanks & Regards
Raghu Ram

Re: new instance of postgres on windows

От
John R Pierce
Дата:
On 7/18/2013 3:48 AM, raghu ram wrote:

The password you need to reset is at the operating system level.   To do this on Windows, do the following:

1) Right click on the 'My Computer'  desktop icon  ( or if the icon is not on the desktop, open the start menu and right click on the 'My Computer' menu item)

2) Choose 'Manage' from the pop up menu

3) Expand the 'Local Users and Groups' folder

4) Expand the 'Users' folder

5) On the right hand side of the screen, you will see all the users defined on the system.

6) You can right click on the "postgres" user name and choose 'Set Password' and then change it to something else

OR  You can delete the user and then have the installer recreate the user.

You will need to be logged into the computer as an administrative user to do the above. 

which will break the existing install


-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

Re: new instance of postgres on windows

От
Eduardo Morras
Дата:
On Thu, 18 Jul 2013 09:17:34 -0700
John R Pierce <pierce@hogranch.com> wrote:

> which will break the existing install

Throw Windows away defenestrating the server

Feed a dvd with last FreeBSD or Linux distro or Unix U Want.

Restart.

Install from dvd.

Install Postgres and whatever you want the times you want with the configuration you want.

Run.

---   ---
Eduardo Morras <emorrasg@yahoo.es>


Re: new instance of postgres on windows

От
Thomas Kellerer
Дата:
Arvind Singh wrote on 18.07.2013 12:22:
> I want to install postgresql for use as the backend to a Windows application.
>
> This seems to be no problem if postgresql is NOT already installed on the system. which is not in this case.
>
> postgresql is already installed and  unless the command line parameters contain the superpassword etc of the
>existing installation , the install fails. As I will likely never know the superpassword
>or other account details of any pre-existing postgresql instances and the machine owners may not either.
>
> How to then proceed and install a new  instance that can  be used by our application.

It's unclear to me if you want to re-use the existing installation and create a new cluser (aka "data directory" by
runninginitdb 
or if you want to install a completely new version along the original one (with it's own server and data directory)

If you want to install a completely new instance, just put it into a different directory, and given the service a
differentname. 

Newer Postgres versions don't need a dedicated Windows user account any more.

I usually don't use the installer any more, but I simply unzip the binary distribution, then run initdb with a
directoryof my choice (making sure the privileges are correctly setup) and then use pg_ctl to register the service. The
onlything you need to make sure is to change the port in postgresql.conf before starting the service. 

Something like this (batch file commands):

  echo superuserpassword> pwfile.txt
  unzip postgresql-9.2.4-1-windows-binaries.zip -d c:\MyApp\Postgres
  mkdir c:\MyApp\Data
  c:\MyApp\Postgres\bin\initdb -D c:\MyApp\Data -U postgres -pwfile=pwfile.txt -E UTF8 -A md5
  c:\MyApp\Postgres\bin\pg_ctl register -N my-app-postgres -S auto

Again: you have to make sure that the data directory has all the right privileges!



Re: new instance of postgres on windows

От
John R Pierce
Дата:
On 7/18/2013 11:48 AM, Eduardo Morras wrote:
> On Thu, 18 Jul 2013 09:17:34 -0700
> John R Pierce<pierce@hogranch.com>  wrote:
>
>> >which will break the existing install
> Throw Windows away defenestrating the server
>
> Feed a dvd with last FreeBSD or Linux distro or Unix U Want.
>
> Restart.
>
> Install from dvd.
>
> Install Postgres and whatever you want the times you want with the configuration you want.
>
> Run.

join unemployment line if you work at a Windows shop, or are selling an
end user application intended for Windows users.




--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: new instance of postgres on windows

От
John R Pierce
Дата:
On 7/18/2013 12:03 PM, Thomas Kellerer wrote:
> If you want to install a completely new instance, just put it into a
> different directory, and given the service a different name.
>
> Newer Postgres versions don't need a dedicated Windows user account
> any more.
>
> I usually don't use the installer any more, but I simply unzip the
> binary distribution, then run initdb with a directory of my choice
> (making sure the privileges are correctly setup) and then use pg_ctl
> to register the service. The only thing you need to make sure is to
> change the port in postgresql.conf before starting the service.


yeah, for an application 'embedded' install, that's DEFINITELY the way
to go.   package up all the postgresql files with your app installer,
and install them in a folder under your app (C:\Program
Files\MyName\MyApp\MyPostgresql\... or whatever), use a app unique
service name and pick a alternate port number.    Only challenge is
where to put the data directory.... I don't think these should be under
C:\Program Files under ANY conditions, but they don't belong in the
current user's %USERPROFILE%\AppData\Local either... I  note newer
Windows has a C:\ProgramData, so perhaps thats the 'right' default choice?



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: new instance of postgres on windows

От
Thomas Kellerer
Дата:
John R Pierce, 18.07.2013 21:20:
>> If you want to install a completely new instance, just put it into
>> a different directory, and given the service a different name.
>>
>> Newer Postgres versions don't need a dedicated Windows user account
>> any more.
>>
>> I usually don't use the installer any more, but I simply unzip the
>> binary distribution, then run initdb with a directory of my choice
>> (making sure the privileges are correctly setup) and then use
>> pg_ctl to register the service. The only thing you need to make
>> sure is to change the port in postgresql.conf before starting the
>> service.
>
>
> service name and pick a alternate port number.    Only challenge is
> where to put the data directory. I don't think these should be
> under C:\Program Files under ANY conditions

Absolutely.


> but they don't belong in the current user's %USERPROFILE%\AppData\Local either

Correct.

> I  note newer Windows has a C:\ProgramData, so perhaps thats the 'right'
> default choice?

Sounds good to me. The best option is probably to ask the user during installation
(and disallow "c:\Program Files" )