0

I have successfully installed Postgres on Ubuntu 20.04 by running the following commands:

$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib libpq-dev

which was successful. I then run the command:

$ sudo service postgresql start

which was also successful. However, the command

$ sudo -u postgres createdb $USER

failed. The error message was as follows:

createuser: error: could not connect to database template1: 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"?

Please help me out.

Kevson
  • 1
  • 1
  • Does this answer your question? [Create a Superuser in postgres](https://stackoverflow.com/questions/57975093/create-a-superuser-in-postgres) – Harish Nov 01 '21 at 10:32
  • It looks like postgresql is not running. It probably starts and ends with an error. Have a look at the log-files in /var/log/postgresql – Steeeve Nov 01 '21 at 10:35
  • Perhaps the automagic of the Ubuntu installation packages selected a port different from 5432. – Laurenz Albe Nov 02 '21 at 04:54

0 Answers0