0

I am trying to setup postgres on ubuntu, and I cant proceed as I cant find the location of pg_hba.conf

(Postgres 8.4 on ubuntu 9.10)

What I did

  1. setup postgres via aptitude

This gave me ...

/usr/share/postgresql/8.4# aptitude install postgresql
Reading package lists... Done
Building dependency tree 
Reading state information... Done
Reading extended state information 
Initializing package states... Done
The following NEW packages will be installed:
libreadline5{a} postgresql postgresql-8.4{a} postgresql-client-8.4{a} postgresql-client-common{a} postgresql-common{a} 
0 packages upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/5,159kB of archives. After unpacking 18.8MB will be used.
Do you want to continue? [Y/n/?] Y
Writing extended state information... Done
Preconfiguring packages ...
Selecting previously deselected package libreadline5.
(Reading database ... 17490 files and directories currently installed.)
Unpacking libreadline5 (from .../libreadline5_5.2-6_amd64.deb) ...
Selecting previously deselected package postgresql-client-common.
Unpacking postgresql-client-common (from .../postgresql-client-common_101_all.deb) ...
Selecting previously deselected package postgresql-client-8.4.
Unpacking postgresql-client-8.4 (from .../postgresql-client-8.4_8.4.1-1_amd64.deb) ...
Selecting previously deselected package postgresql-common.
Unpacking postgresql-common (from .../postgresql-common_101_all.deb) ...
Selecting previously deselected package postgresql-8.4.
Unpacking postgresql-8.4 (from .../postgresql-8.4_8.4.1-1_amd64.deb) ...
Selecting previously deselected package postgresql.
Unpacking postgresql (from .../postgresql_8.4.1-1_all.deb) ...
Processing triggers for man-db ...
Setting up libreadline5 (5.2-6) ...

Setting up postgresql-client-common (101) ...
Setting up postgresql-client-8.4 (8.4.1-1) ...
update-alternatives: using /usr/share/postgresql/8.4/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode.

Setting up postgresql-common (101) ...

Setting up postgresql-8.4 (8.4.1-1) ...
update-alternatives: using /usr/share/postgresql/8.4/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode.

Setting up postgresql (8.4.1-1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Reading package lists... Done 
Building dependency tree 
Reading state information... Done
Reading extended state information 
Initializing package states... Done
Writing extended state information... Done
  1. tried to login as

    su - postgres

Followed by

createdb mytestdb

This failed with

could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

So I though I need to enable local connections in pg_hba.conf, which I cant find. So I created a new file as

sudo vim /etc/postgresql/8.4/main/pg_hba.conf

With values

local all all ident

But I still cant login after restarting the service. What are next steps for me to take.

2 Answers 2

1

Looking at that output, it simply looks like the server isn't started. Just do a "/etc/init.d/postgresql-8.4 start".

1
  • Had already tried restarting etc, but tried again anyway. :). This is the outout. (I am root.) dpaste.de/POn6
    – shabda
    Apr 8, 2010 at 12:20
0

This usually hapen when you don't specify the host and then the client try to run against ipv6. You must to declare;

createdb mytestdb -h localhost

or

createdb mytestdb -h 127.0.0.1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .