0

Freshly installed Debian Jessie. I've installed: aptitude install postgresql postgresql-contrib

root@vps: createuser
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"?

Why isn't it working? I've tried any single solution posted here: Debian PostgreSQL doesn't appear to be working

Not a single one works.

/var/lib/postgresql/ is empty. /etc/postegresql doesn't even exists.

I tried running: pg_createcluster 9.4 main --start

But then I get this:

createuser
createuser: could not connect to database postgres: FATAL:  role "root" does not exist

Or this, if I do it from scratch:

root@vps:~# pg_createcluster 9.4 main --start
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.UTF-8",
        LC_ALL = "en_US.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Error: The locale requested by the environment is invalid.

So I uninstalled, ran unset LC_TIME as suggested here, reinstalled, but now I get the original error.

Can you please give me the set of comands I have to run to install postgres on a fresh Debian install?

EDIT: tried following the official guide here. That also doesn't work.

root@vps:/# wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - apt-get update
gpg: no valid OpenPGP data found.

I'm really at a loss here. Is anyone even maintaining this stuff?

EDIT: tried reinstalling the whole server and running apt-get install postgresql-9.4 postgresql-client-9.4 but got the same errors.

Tried to run this from here:

export LANGUAGE="en_US.UTF-8"
echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale

problem isn't solved.

EDIT: I have tried this:

export LANG=en_US.UTF-8

and this

root@vps:~# update-locale --reset
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.UTF-8",
        LC_ALL = "en_US.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

and this: dpkg-reconfigure locales

*** update-locale: Error: invalid locale settings:  LC_ALL="en_US.UTF-8" LANGUAGE="en_US.UTF-8" LANG=en_GB.UTF-8
1

What the error messages indicate is that your system is configured to use en_US.UTF-8 as the locale through the environment variables, but it's not installed.

Install it with

sudo locale-gen en_US.UTF-8

Once done, if postgresql is not installed, apt-get install postgresql will install it and initialize a default cluster with /var/lib/postgresql/version/main and so on.

If postgresql is already installed and a cluster doesn't exist due to the creation failing initially, pg_createcluster 9.4 main --start will create one. If in doubt about what clusters do exist/are online, check with pg_lsclusters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.