1

I am trying to get a copy of Openbravo on Ubuntu for development. I am following the official guide and I get stuck by a Postgres error.

I have successfully downloaded the source code through the mercurial commands. ant setup also worked for me.

When I run the Wizard I write this information.

Wizard

The problem comes when I run ant install.source:

BUILD FAILED
/home/User/openbravo/build.xml:734: The following error occurred while executing this line:
/home/User/openbravo/src-db/database/build-create.xml:50: The following error occurred while executing this line:
/home/marcguilera/openbravo/src-db/database/build-create.xml:77: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:136)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)

The stacktrace is longer.

yafrack
  • 654
  • 1
  • 8
  • 24
  • write 127.0.0.1 instead of localhost. and try to connect again – Ilesh Patel Apr 16 '14 at 10:09
  • Thanks, but same error – yafrack Apr 16 '14 at 10:31
  • "Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections." so, have you? – Milen A. Radev Apr 16 '14 at 14:48
  • try to connect to the database using PGAdmin with the same credentials mentioned above... If you are not able to connect to the server, Please make sure to provide the correct Admin role and Admin role password.. – Velu Apr 16 '14 at 18:48
  • If I try to connect through pgAdming at localhost:5432, U: tad, Pwd: tad, Mainteniance DB: postgres it crashes. 'could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?' – yafrack Apr 30 '14 at 08:59
  • I could make localhost listen and now the problem is for login -> An error has occurred: Error connecting to the server: FATAL: password authentication failed for user "tad" FATAL: password authentication failed for user "tad" – yafrack May 05 '14 at 08:30
  • This helped to solve the problem: http://stackoverflow.com/questions/7695962/postgresql-password-authentication-failed-for-user-postgres – yafrack May 05 '14 at 08:49

1 Answers1

2

I) First we need to change the PostgreSQL postgres user password else we will not be able to access the server. As the “postgres” Linux user, we will execute the psql commands below.


In a terminal, type:

$ sudo -u postgres psql postgres

Set a password for the "postgres" database role using the command:

\password postgres

II) Create database


To create the first database, which we will call leo, simply type:

sudo -u postgres createdb leo

III) install Server Instrumentation (for PgAdmin) for Postgresql 9.1


PgAdmin requires the installation of an add-on for full functionality. The "adminpack" addon, which it calls Server Instrumentation, is part of postgresql-contrib, so you must install that package. Then to activate the extension, For "Postgresql 9.1"+ install the adminpack "extension" in the "postgres" database:

$ sudo -u postgres psql


then

CREATE EXTENSION adminpack;

IV) Using pgAdmin III GUI


To get an idea of what PostgreSQL can do, you may start by firing up a graphical client. In a terminal type :

pgadmin3

You will be presented with the pgAdmin III interface. * Click on the "Add a connection to a server" button (top left).

In the new dialog:

enter the address **127.0.0.1** 

host is  **jdbc:postgresql://localhost:5432/postgres**

the default database ("leo" in the example above)
  • your username ("postgres") and your password.

One more step is required in order to allow pgAdmin III to connect to the server, and that is to edit pg_hba.conf file and change the authentication method from peer to md5 (Will not work if you have not set the password.):

sudo nano /etc/postgresql/9.1/main/pg_hba.conf

and change the line

# Database administrative login by Unix domain socket
local   all             postgres                                peer

to

# Database administrative login by Unix domain socket
local   all             postgres                                md5

Now you should reload the server configuration changes and connect pgAdmin III to your PostgreSQL database server.

sudo /etc/init.d/postgresql reload

With this GUI you may start creating and managing databases, query the database, execute SQl etc.

https://help.ubuntu.com/community/PostgreSQL

v) Run openbravo with postgres


Just adjust the db name, user name and the passwords. Hope that helps.

Y. Leonce Eyog
  • 883
  • 2
  • 13
  • 29