After installation via $ sudo apt install postgresql
I haven't managed to setup user and create database, in both cases it stated:
$ sudo -u postgres createuser --createdb dreu007
could not change directory to "/home/dreu007": Permission denied
createuser: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
$ sudo -u postgres createdb --owner=dreu007 hexlet
could not change directory to "/home/dreu007": Permission denied
createdb: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Then I checked:
$ psql -U postgres
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Basic attempt to restart $ sudo service postgresql restart
didn't change anything.
Checked process:
$ ps aux | grep postgres
dreu007 16844 0.0 0.0 12804 4192 pts/1 S+ 10:04 0:00 man postgres
dreu007 19505 0.0 0.0 10836 2352 pts/2 S+ 10:33 0:00 grep --color=auto postgres
Looks like nothing is running.
I have tried to follow these threads: 1 & 2 and met difficulties to locate pg_hba.conf
in /etc/postgresql/
The directory is empty. Same issue here /var/run/postgresql/
, empty.
psql (PostgreSQL) 14.8 (Ubuntu 14.8-0ubuntu0.22.04.1)