1

I am using 4.14.10-2-MANJARO. I have tried to install Postgres Database. I have installed postgresql 10.1-1 by using command:

yaourt -S postgresql

And then:

sudo -u postgres -i

initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'

createuser --interactive

And then I have got something like this:

createuser: could not connect to database postgres: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"?

I don't know how to solve it. I have been using this website:

https://wiki.archlinux.org/index.php/PostgreSQL#Installing_PostgreSQL

Then I would like to create a new database by command:

createdb myDatabaseName

Thank you.

6
  • Two questions: 1) Is the server running locally and 2) accepting connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"? Commented Jan 28, 2018 at 18:49
  • 1
    @wildplasser Actually there is single question: "did you try to google for connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432""? Commented Jan 28, 2018 at 20:00
  • @wildplasser ad 1) I don;t know but I think that no and I don't know how to run it. Abelisto Yes I tried but there is so many description how to make it and none of them work. Maybe it is because I am using Manjaro and it is based on Arch and most of answers are regarding to Ubuntu. Commented Jan 28, 2018 at 23:16
  • 1
    What's the output of systemctl status postgresql.service? From the error message it sounds as if the server is not running. Did initdb produce any error output? Commented Jan 29, 2018 at 1:07
  • Ok. Personally I never facing with such problem but as I read it is because there is no DB cluster. Try postgresql.org/docs/current/static/creating-cluster.html and good luck. Commented Jan 29, 2018 at 5:57

2 Answers 2

1

I had the same problem and I am also running 4.19.1-1-MANJARO and postgresql 10.5-3, but most answers are for Ubuntu and refers to directories that don't exist on Manjaro.

You have to run systemctl to check the service to see what is wrong

sudo systemctl status postgresql

It gives something like this

systemd[1]: Starting PostgreSQL database server...
postgres[3902]: "/var/lib/postgres/data" is missing >
postgres[3902]:   su - postgres -c "initdb --locale >

and it tells you to run the su command listed above. But this requires the password of the user postgres. To go around this we sudo the command instead.

sudo su - postgres -c "initdb --locale en_US.UTF-8 -D /var/lib/postgres/data'"

When this command is finished it tells you to run pg_ctl -D /var/lib/postgres/data start, but instead just start it via systemctl.

sudo systemctl enable postgresql
sudo systemctl start postgresql
Sign up to request clarification or add additional context in comments.

Comments

0

After creating the data directory with initdb, you need to start the database server process with

pg_ctl -D /var/lib/postgres/data start

But before that, you should edit /var/lib/postgres/data.postgresql.conf and set parameters like listen_addresses, port, shared_buffers and everything concerning logging.

That way, you can consult the log file after starting the server to see if everything went well.

Comments

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.