PostgreSQL Installation – Postgres 9.4.1 on Ubuntu 14.04.2 LTS Fails to Install

postgresqlUbuntu

I'm trying to install PostgreSQL 9.4.1 on Ubuntu 14.04.2. I'm using the packages from apt.postgresql.org.

The package installs but it fails running pg_createcluster. If I run manually, I get:


Creating new cluster 9.4/main...
config /etc/postgresql/9.4/main
data /var/lib/postgresql/9.4/main
locale en_US.UTF-8
Flags of /var/lib/postgresql/9.4/main set as --------------e-C
Error: initdb failed

I can't find any details as to why initdb fails.

If I manually run initdb as the postgres user, that works, but that does not create the config files.

I checked everything I could think of, including on-line and can't find a solution.

Best Answer

Not an elegant solution but after installing the package using apt-get (which fails creating the cluster but installs PostgreSQL), I switched to the postgres user and created the database using initdb. Then back to root, I created the cluster using the pg_createcluster command.

This moved the configurations to /etc/postgres/9.4/main and set it all up.