6

I've just installed the postgresql 9.1 on one brand new Ubuntu 12.04 LTS server with the following command : sudo apt-get install postgresql libpq-dev The installation proceeded without errors. Basically I should be able to connect to local server, however when I tap the command psql, the following errors appears :

psql: 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"?

I've searched a lot of posts online, but cannot solve problem (very often, the mentioned directory doesn't exist on my server). Can anyone suggests some solutions ? Thanks !

2
  • 1
    Did you start the postgres server? psql is a client, the server must be running when you attempt to connect to it. See postgresql.org/docs/9.1/static/server-start.html Commented Jul 29, 2013 at 20:59
  • 3
    Have you tried sudo /etc/init.d/postgresql-9.1 start or sudo systemctl start postgresql to start the server ? Commented Jul 29, 2013 at 21:01

1 Answer 1

9

It seems that you did not install postgresql successfully. Please follow here:

sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get -y update
sudo apt-get purge postgresql* # ending * is important
sudo apt-get install postgresql libpq-dev

It will fix your problem.

Sign up to request clarification or add additional context in comments.

1 Comment

This worked for me, even without adding the ppa:pitti/postgresql repository. I guess I just needed the libpq-dev package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.