I've installed postgresql server via ubuntu repository and the service is active. When I try to add a user this is the result:
sudo -u postgres createuser -D -A -P myuser
Enter password for new role:
Enter it again:
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 "/var/run/postgresql/.s.PGSQL.5432"?

Here the line of listen address in postgresql.conf
listen_addresses = '*'

Here the pg_hba.conf:

Database administrative login by Unix domain socket

local all postgres peer
"local" is for Unix domain socket connections only

local all all peer
IPv4 local connections:

host all all md5
IPv6 local connections:

host all all ::1/128 md5
Allow replication connections from localhost, by a user with the
replication privilege.

#local replication postgres peer
#host replication postgres md5
#host replication postgres ::1/128 md5
host all all md5