Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to set up a PostgreSQL server using the instructions found on here. I installed the package via apt-get install postgresql and now I'm on the step:

sudo -u postgres psql postgres

which gives the error:

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'm guessing the server isn't running but I'm not sure how to start it. Any tips would be much appreciated.

UPDATE: Running service postgresql status doesn't output anything, even after sudo service postgresql start.

UPDATE #2: Running ps auxw | grep post doesn't turn up anything either, so I'm guessing the server daemon isn't running.

share|improve this question
    
When you ran apt-get install postgresql, did you check that the installation actually was successful? Please report the output of apt-cache policy postgresql postgresql-9.1. –  zwets Dec 12 '13 at 6:16

1 Answer 1

up vote 1 down vote accepted

Check what database clusters are currently created:

pg_lsclusters

If there is one, but it's not running, then start it (substituting the version and name):

sudo pg_ctlcluster x.y name start

If there isn't one, create one and have it started:

sudo pg_createcluster --start x.y name

Normally, this should have happened automatically when you install the package. So either something happened during package installation, or the package was already installed and someone had already messed around with the things I show above.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.