Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to start postgresql server on Ubuntu 12.04

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"

like image 530
Ensom Hodder Avatar asked Aug 16 '13 20:08

Ensom Hodder


1 Answers

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]

like image 174
Don Pflaster Avatar answered Oct 05 '22 23:10

Don Pflaster