Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   PostgreSQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=42)
-   -   ¿como instalar postgresql en windows 7? (https://www.clubdelphi.com/foros/showthread.php?t=78490)

JXJ 24-04-2012 17:58:44

¿como instalar postgresql en windows 7?
 
Hola pues esa es mi duda.

he bajado el ultimo instalador de postgresql que usa bitrock como instalador.
tengo windows 7 , mi cuenta de usuario es la del administrador. y no tengo creadas ninguna otra cuenta.

el instalador se ejecuta bien?(realmente no es una porqueria dice que el pgroama se instala cuando no. y no hace un rollback
todos los archivos siguen ahi.)?

baje las versiones de aqui las 9.1.3
http://www.enterprisedb.com/products...wnload#windows
ambas . la de windows 32 y windows 64

segun todo se instala bien pero al final
dice error al inicializar cluster.

ya busque en google y postgresql no es como firebird. algo hace con los usuarios del sistema si no no sirve
no se como arreglarlo. ya elimine usuarios postgre enterprisedb
y sus carpetas. y sigue dando error.

y encontre que hay version que son puro binarios sin instalador de aqui

http://www.enterprisedb.com/products.../pgbindownload

ya los baje. ahora el problema es el mismo
¿como logro instalar postgresql a mano con los puros binarios?

supongo que eso de inicializar el clustes es crear la base de datos postgre por defecto
en alguna carpeta del sistema. y asignarle permisos al usuario postgre
que el instalador para windows crea.

no sabesn si hay algun script para usar innosetup para todas esas tareas.
un instalador y su escript para postgresql hecho con innosetup para compilarlo
bitrock parece que apesta.

gracias.

mamcx 24-04-2012 18:43:53

Mira esto:

http://www.geekscribes.net/blog/2009...iled-solution/

En general, es buena idea instalar cualquier motor de BD fuera de archivos de programa.

JXJ 24-04-2012 19:39:07

wwwoww.

gracias mamcx.

con los datos pasados encontre otro
http://forums.holdemmanager.com/gene...on-failed.html

Código:

Solution:
- Uninstall PostgreSQL
- net user postgres /delete
- Control Panel -> User Accounts -> Configure advanced user profile properties -> delete all "Unknown User" instances that seem to be left from postgres
- compmgmt.msc -> Local Users and Groups -> Users -> New User... -> User name: postgres, Password: postgrespass -> Create
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Add... -> Administrators -> OK
- copy postgresql-8.4.9-1-windows.exe to C:\
- runas /user:postgres cmd.exe -> cd \ -> postgresql-8.4.9-1-windows.exe -> installed successfully without errors. Checked data folder and confirmed files created successfully.
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Administrators -> Remove
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Add... -> Power Users -> OK
- Installed HM2 -> created db successfully
- Restarted computer -> HM2 runs properly (i.e. just to check postgresql service starts automatically)

Kind of annoying that no one else seems to have had this specific problem with postgresql on the HM forums.

Oh, related troubleshooting step that might help others. I had an earlier problem of *.vbs files being associated with vim instead of Windows Scripting Host when trying to install another program. So if youre getting Visual C++ errors even though you've got Visual C++ 2005/2008/2010 redistributables installed, try registering vbscript.dll:

- regsvr32 %systemroot%\system32\vbscript.dll


roman 24-04-2012 19:45:00

Es más fácil que todo eso. Simplemente corran la instalación normal instalando en donde debe ser, es decir, en Program Files, pero, eso sí, seleccionando la carpeta data fuera de Program Files. Yo lo he hecho en "C:\ProgramData\PostgreSQL\9.1\data" por simple analogía con la instalación de MySQL. Con eso, el instalador de PostgreSQL corre sin problemas sin andar instalando en la raíz ni creando usuarios a mano.

// Saludos

JXJ 24-04-2012 23:51:11

no funciono roman.

”I was tired and annoyed. The “World’s most advanced open source database” had failed to install!” – I so agree with you. Took me 1,5 hours. After reading your guide, still this thing doesn’t work for me. Running on Windows server 2003

Casimiro Notevi 25-04-2012 00:01:04

¿Y ese mensaje?

roman 25-04-2012 00:01:47

Sí, no sé qué tiene que ver ese mensaje. A m me ha funcionado bien en Windows 7 32 bits.

// Saludos

roman 25-04-2012 00:04:40

Po otra parte, hay que considerar que los instaladores para windows no los hace el propo PostgreSQL, según entiendo, así que no es propiamente culpa de ellos los posibles defectos.

// Saludos

JXJ 25-04-2012 00:17:45

Firebird el mejor del mundo. si.. :D:D:D posgresql apesta..

JXJ 25-04-2012 00:31:06

si el instalador apesta bitrock. segun parace es para todos los Sistemas operativos ..el instaldor grafico
en nix. pues parece que usa otras cosas si no es grafico.
especialmente windows. bull shit.. disque empresa española. pero no manchen. no avisa bien que pex.

JXJ 25-04-2012 00:31:40

roman siempre, te expresas de una forma. que solo puedo estar de acuerdo.. ..

Casimiro Notevi 25-04-2012 00:36:05

Cita:

Empezado por JXJ (Mensaje 430831)
Firebird el mejor del mundo. si.. posgresql apesta..

Cita:

Empezado por JXJ (Mensaje 430834)
si el instalador apesta bitrock. segun parace es para todos los Sistemas operativos ..el instaldor grafico
en nix. pues parece que usa otras cosas si no es grafico.
especialmente windows. bull shit.. disque empresa española. pero no manchen. no avisa bien que pex.

:confused::confused::confused::confused::confused::confused::confused::confused::confused:.......... ..

JXJ 25-04-2012 02:01:42

a eso casimiro notevi. es por que buscano con que instalador lo hicieron encontre que la toman como gran empresa.
bueno para micaso. el instalador no funciona como el innosetup.

y a mi desesperacion.. de que no instala el postgresql.

una duda. buscando en el codigo de instalacion

hay un vbscript que se encarga de la inicializacion del cluster de base de datos
usando un programa initdb

el codigo llama asi.
[/code]
' Check the command line
If WScript.Arguments.Count <> 11 Then
Wscript.Echo "Usage: initcluster.vbs <OSUsername> <SuperUsername> <Password> <Install dir> <Data dir> <xlog dir> <Port> <Locale> <Mode> <server_utilization> <workload_profile>"
Wscript.Quit 127
End If
[/code]

y en el log de instalacion se llama a ese vb con los parametros

Código:

Executing cscript //NoLogo "C:\PostgresPlus\8.4AS\installer\server/initcluster.vbs" "enterprisedb" "enterprisedb" "****" "C:\PostgresPlus\8.4AS" "C:\PostgresPlusData" "C:\PostgresPlusData\pg_xlog" 5444 "DEFAULT" "oracle" "66" "oltp"cd
mi problema es aqui

<OSUsername> <SuperUsername> <Password>

"enterprisedb" "enterprisedb" "****"

¿saben que contraseña tiene el usuario enterprisedb ?
por que ahi lo enmascaran y lo crea el instalador.


Código:

On Error Resume Next

' Postgres Plus Advanced Server server cluster init script for Windows
' Dave Page, EnterpriseDB

Const ForReading = 1
Const ForWriting = 2

' Check the command line
If WScript.Arguments.Count <> 11 Then
 Wscript.Echo "Usage: initcluster.vbs <OSUsername> <SuperUsername> <Password> <Install dir> <Data dir> <xlog dir> <Port> <Locale> <Mode> <server_utilization> <workload_profile>"
 Wscript.Quit 127
End If

strOSUsername = WScript.Arguments.Item(0)
strUsername = WScript.Arguments.Item(1)
strPassword = WScript.Arguments.Item(2)
strInstallDir = WScript.Arguments.Item(3)
strDataDir = WScript.Arguments.Item(4)
strXlogDir = WScript.Arguments.Item(5)
lPort = CLng(WScript.Arguments.Item(6))
strLocale = WScript.Arguments.Item(7)
strDatabaseMode = WScript.Arguments.Item(8)
strServerUtilization = WScript.Arguments.Item(9)
strWorkLoadProfile = WScript.Arguments.Item(10)
strMode=" "

'set database mode to --no-redwood-compat if mode is postgresql
If strDatabaseMode = "postgresql" Then
strMode = "--no-redwood-compat"
End If


' Remove any trailing \'s from the data dir - they will confuse cacls
If Right(strDataDir, 1) = "\" Then
    strDataDir = Left(strDataDir, Len(strDataDir)-1)
End IF
' Remove any trailing \'s from the xlog dir - they will confuse cacls
If Right(strXlogDir, 1) = "\" Then
    strXlogDir = Left(strXlogDir, Len(strXlogDir)-1)
End IF

Dim strInitdbPass
iWarn = 0

' Get temporary filenames
Set objShell = WScript.CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTempFolder = objFso.GetSpecialFolder(2)
strBatchFile = Replace(objFso.GetTempName, ".tmp", ".bat")
strOutputFile = objTempFolder.Path & "\" & objFso.GetTempName
Set objFso = CreateObject("Scripting.FileSystemObject")

' Change the current directory to the installation directory
' This is important, because initdb will drop Administrative
' permissions and may lose access to the current working directory
objShell.CurrentDirectory = strInstallDir

' Is this Vista or above?
Function IsVistaOrNewer()
    Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
    Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
       
    For Each objItem In colItems
        strVersion = Left(objItem.Version, 3)
    Next
       
    If InStr(strVersion, ".") > 0 Then
        majorVersion = CInt(Left(strVersion,  InStr(strVersion, ".") - 1))
    ElseIf InStr(strVersion, ",") > 0 Then
        majorVersion = CInt(Left(strVersion,  InStr(strVersion, ",") - 1))
    Else
        majorVersion = CInt(strVersion)
    End If
       
    If majorVersion >= 6.0 Then
        IsVistaOrNewer = True
    Else
        IsVistaOrNewer = False
    End If
End Function

' Execute a command
Function DoCmd(strCmd)
    Set objBatchFile = objTempFolder.CreateTextFile(strBatchFile, True)
    objBatchFile.WriteLine "@ECHO OFF"
    objBatchFile.WriteLine strCmd & " > """ & strOutputFile & """ 2>&1"
        objBatchFile.WriteLine "EXIT /B %ERRORLEVEL%"
    objBatchFile.Close
    DoCmd = objShell.Run(objTempFolder.Path & "\" & strBatchFile, 0, True)
    If objFso.FileExists(objTempFolder.Path & "\" & strBatchFile) = True Then
        objFso.DeleteFile objTempFolder.Path & "\" & strBatchFile, True
    End If
    If objFso.FileExists(strOutputFile) = True Then
        Set objOutputFile = objFso.OpenTextFile(strOutputFile, ForReading)
        WScript.Echo objOutputFile.ReadAll
        objOutputFile.Close
        objFso.DeleteFile strOutputFile, True
    End If
End Function

Sub Die(msg)
    If objFso.FileExists(strInitdbPass) = True Then
        objFso.DeleteFile strInitdbPass, True
    End If
    WScript.Echo msg
    WScript.Quit 1
End Sub

Sub Warn(msg)
    WScript.Echo msg
    iWarn = 2
End Sub

Function CreateDirectory(DirectoryPath)
    If objFso.FolderExists(DirectoryPath) Then Exit Function

    Call CreateDirectory(objFso.GetParentFolderName(DirectoryPath))
    objFso.CreateFolder(DirectoryPath)
End Function

' Create a password file
strInitdbPass = strInstallDir & "\" & objFso.GetTempName
Set objInitdbPass = objFso.OpenTextFile(strInitdbPass, ForWriting, True)
WScript.Echo Err.description
objInitdbPass.WriteLine(strPassword)
objInitdbPass.Close

' Create the data directory
If objFso.FolderExists(strDataDir) <> True Then
    CreateDirectory(strDataDir)
    If Err.number <> 0 Then
        Die "Failed to create the data directory (" & strDataDir & ")"
    End If
End If


'for default xlog dir, don't pass -X parameter
strXLogArg = ""

'Create pg_xlog directory if it is not the default one
If strXlogDir <> strDataDir & "\pg_xlog" Then
  strXlogDir = strXlogDir & "\pg_xlog"
  strXLogArg = " -X """ & strXlogDir & """ "
  If objFso.FolderExists(strXlogDir) <> True Then
      CreateDirectory(strXlogDir)
      If Err.number <> 0 Then
        Die "Failed to create the XLog directory (" & strXlogDir & ")"
      End If
  End If
End If

Set objNetwork = CreateObject("WScript.Network")

iRetXlog = 0

If IsVistaOrNewer() = True Then
    WScript.Echo "Ensuring we can write to the data directory (using icacls):"
    iRet = DoCmd("icacls """ & strDataDir & """ /T /grant:r """ & objNetwork.Username & """:F")
    WScript.Echo "Ensuring we can write to the xlog directory if it exists (using icacls)"
    If objFso.FolderExists(strXlogDir) = True Then
      iRetXlog = DoCmd("icacls """ & strXlogDir & """ /T /grant:r """ & objNetwork.Username & """:F")
    End If
Else
    WScript.Echo "Ensuring we can write to the data directory (using cacls):"
    iRet = DoCmd("echo y|cacls """ & strDataDir & """ /E /T /G """ & objNetwork.Username & """:F")
    WScript.Echo "Ensuring we can write to the xlog directory if it exists (using cacls):"
    If objFso.FolderExists(strXlogDir) = True Then
      iRetXlog = DoCmd("echo y|cacls """ & strXlogDir & """ /E /T /G """ & objNetwork.Username & """:F")
    End If
End If
if iRet <> 0 Then
    WScript.Echo "Failed to ensure the data directory is accessible (" & strDataDir & ")"
End If
if iRetXlog <> 0 Then
    WScript.Echo "Failed to ensure the xlog directory is accessible (" & strXlogDir & ")"
End If

' Initialise the database cluster, and set the appropriate permissions/ownership
if strLocale = "DEFAULT" Then
    iRet = DoCmd("""" & strInstallDir & "\bin\initdb.exe"" " & strMode & "  --pwfile """ & strInitdbPass & """ --encoding=UTF-8 -A md5 -U " & strUsername & " -D """ & strDataDir & """" & strXLogArg & "")
Else
    iRet = DoCmd("""" & strInstallDir & "\bin\initdb.exe"" " & strMode &"  --pwfile """ & strInitdbPass & """ --locale=""" & strLocale & """ --encoding=UTF-8 -A md5 -U " & strUsername & " -D """ & strDataDir & """" & strXLogArg & "")
End If

if iRet <> 0 Then
    Die "Failed to initialise the database cluster with initdb"
End If

' Delete the password file
If objFso.FileExists(strInitdbPass) Then
    objFso.DeleteFile strInitdbPass, True
End If

' Edit the config files
' Set the following in postgresql.conf:
'      listen_addresses = '*'
'      port = $PORT
'      log_destination = 'stderr'
'      logging_collector = on
Set objConfFile = objFso.OpenTextFile(strDataDir & "\postgresql.conf", ForReading)
strConfig = objConfFile.ReadAll
objConfFile.Close
strConfig = Replace(strConfig, "#listen_addresses = 'localhost'", "listen_addresses = '*'")
strConfig = Replace(strConfig, "#port = 5432", "port = " & lPort)
strConfig = Replace(strConfig, "#port = 5444", "port = " & lPort)
strConfig = Replace(strConfig, "#log_destination = 'stderr'", "log_destination = 'stderr'")
strConfig = Replace(strConfig, "#logging_collector = off", "logging_collector = on")
strConfig = Replace(strConfig, "#log_line_prefix = ''", "log_line_prefix = '%t'")
strConfig = Replace(strConfig, "edb_dynatune = 66", "edb_dynatune = " & strServerUtilization)
strConfig = Replace(strConfig, "#edb_dynatune_profile = oltp", "edb_dynatune_profile = " & strWorkLoadProfile)

Set objConfFile = objFso.OpenTextFile(strDataDir & "\postgresql.conf", ForWriting)
objConfFile.WriteLine strConfig
objConfFile.Close

' Secure the data directory

If IsVistaOrNewer() = True Then
    WScript.Echo "Granting service account access to the data directory (using icacls):"
    iRet = DoCmd("icacls """ & strDataDir & """ /T /C /grant:r """ & strOSUsername & """:M")
Else
    WScript.Echo "Granting service account access to the data directory (using cacls):"
    iRet = DoCmd("echo y|cacls """ & strDataDir & """ /E /T /C /G """ & strOSUsername & """:C")
End If
if iRet <> 0 Then
    Warn "Failed to grant service account access to the data directory (" & strDataDir & ")"
End If
' Secure the xlog directory

If IsVistaOrNewer() = True Then
    WScript.Echo "Granting service account access to the xlog directory (using icacls):"
    iRet = DoCmd("icacls """ & strXlogDir & """ /T /C /grant:r """ & strOSUsername & """:M")
Else
    WScript.Echo "Granting service account access to the xlog directory (using cacls):"
    iRet = DoCmd("echo y|cacls """ & strXlogDir & """ /E /T /C /G """ & strOSUsername & """:C")
End If
if iRet <> 0 Then
    Warn "Failed to grant service account access to the xlog directory (" & strDataDir & ")"
End If
WScript.Echo "initcluster.vbs ran to completion"
WScript.Quit iWarn

gracias disculpen la frustracion. expresada.

JXJ 25-04-2012 02:10:28

bueno al segun parece el usuario lo debe de tomar del instalador.
lo raro es que me crea 2 usuarios en windows.

postgres

enterprisedb

JXJ 25-04-2012 03:02:03

avance lo mas complejo es el cluster initialization aun no encuentro que toma para inicializarlo.

el instalador creo un batch
con nombre aleatorio

rad4774c6.bat con el siguiente contenido

@ECHO OFF
"C:\PostgresPlus\8.4AS\bin\initdb.exe" --pwfile "C:\PostgresPlus\8.4AS\rad43075.tmp" --encoding=UTF-8 -A md5 -U enterprisedb -D "C:\PostgresPlus\8.4AS\data" -X "C:\PostgresPlusData\pg_xlog\pg_xlog" > "C:\Users\gdmx\AppData\Local\Temp\radB9EBB.tmp" 2>&1
EXIT /B %ERRORLEVEL%


lo que no se es a que archivos hace referencia. ??
--pwfile "C:\PostgresPlus\8.4AS\rad43075.tmp"

"C:\Users\gdmx\AppData\Local\Temp\radB9EBB.tmp"

roman 25-04-2012 03:04:52

Y, a todo esto, ¿por qué estás instalando una versión antigua?

// Saludos

ElMug 23-07-2012 09:24:32

JXJ,

De Enterprise DB baja el "One-clik-Installer".

Esa instalaion te instala TODO lo que necesitas, no solo PostgreSQL, sino tambien Apache y PHP.

Antes de instalar creo que es mejor desinstalar la instalaicion previa.

En Windows 7 trabaja muy bien. Yo uso todo el de 32 bits.

Casimiro Notevi 23-07-2012 14:32:21

Cita:

Empezado por ElMug (Mensaje 437947)
De Enterprise DB baja el "One-clik-Installer".
Esa instalaion te instala TODO lo que necesitas, no solo PostgreSQL, sino tambien Apache y PHP.

El usuario JXJ no ha indicado en ningún momento que esté desarrollando para la web, por lo que ni necesita apache ni php, lo normal en clubdelphi es usar delphi para crear programas de escritorio.


La franja horaria es GMT +2. Ahora son las 17:56:55.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi