how to start postgresql server on Ubuntu 12.04

35,650

I received this message running a new installation of Postgres 9.3 on Ubuntu 11.04. The full message was:

$ sudo /etc/init.d/postgresql start
Error: Cannot stat /var/run/postgresql
 * No PostgreSQL clusters exist; see "man pg_createcluster"

Turned out that the /var/run/postgresql directory did not exist, and it is in that directory where it was attempting to create a file with the process ID. I created the directory as root and made the "postgres" user the owner, and I was able to start the server.

Further explanation found here: http://www.postgresql.org/message-id/[email protected]

Share:
35,650
Ensom Hodder
Author by

Ensom Hodder

Updated on May 15, 2020

Comments

  • Ensom Hodder
    Ensom Hodder almost 4 years

    I had just installed a PostgreSQL 9.1 on the Ubuntu 12.04 server (hosted by Amazon EWS).When I tried to launch the psql command, the following error message shows up.

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

    After searching on the web, I found I have to start the Server before using it. By following this initdb link, I still cannot use the postgresql database. Are there any further work (like configuration) should I do to start the server ?

    I tried to start the service : service postgresql start Another error message shows :

    No PostgreSQL clusters exist; see "man pg_createcluster"

  • elin3t
    elin3t over 9 years
    I has the same error I fix it with this command sudo pg_createcluster 9.1 main --start