0

I'm running Debian server and use SSH to manage it. Today I tried to install Postgres and follow this steps to do it:

apt-get install postgresql

su - postgres

psql

After the last command I got:

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 found several solutions in the Web, but all of them doesn't works for me. As example I found, that I need to delete "postmaster.pid" in here:

/usr/local/var/postgres/postmaster.pid

But I have no such directory as "postgres" in my "var" folder...

Please, help...:(

2
  • After install, did you also initialize and start the database service? Commented Apr 12, 2015 at 17:32
  • No, I just use this three commands, that I wrote at the begin of that post. Can you tell me initialize command? And wich user I need to use for that command - root or postgres? Commented Apr 12, 2015 at 17:52

1 Answer 1

1

What you did is correct and normally sufficient except when something goes wrong with the automatic creation of the first cluster by apt-get install postgresql. Often there is an error message like this in the middle of the success reports:

Error: could not create default cluster

Since you can't have done any work with postgres yet, purge the packages with

apt-get purge 'postgresql*'

then reinstall with

apt-get install postgresql

but this time, pay close attention to any error message that would imply that the initial cluster was not created, that will give the actual reason of the problem.

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

1 Comment

Thanks for that. After I found that Error - I saw, what prevents Postgres to create cluster. It was errors in my locale.

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.