Postgresql /etc/postgresql doesn't exist

I'm trying to install PostgreSQL 9.1 on a Debian Squeeze server using Backports, but after installation I don't have the /etc/postgresql folder, instead I've got a /etc/postgresql-common folder.

Is there something I'm doing wrong? According to the Debian Wiki I should have a /etc/postgresql/9.1/ folder.


Solution 1:

I know this issue is quite old, but I just stumbled over the same Problem.

Just having a closer look on the output of apt-get install postgresql I noticed the output first states that something is wrong with my locale settings and in the end reports, the cluster could not be created:

Error: The locale requested by the environment is invalid.
Error: could not create default cluster. Please create it manually with

 pg_createcluster 9.1 main --start

or a similar command (see 'man pg_createcluster').

To finally solve the issue it helps to (re-)install the locales and reset the locale configuration. For me (using a debian 7.8 system) this was done by:

apt-get install locales

or

dpkg-reconfigure locales

if it was installed, yet.

Finally reinstall the whole postgresql server system. For me this was

apt-get --purge remove postgresql postgresql-9.1 postgresql-common
apt-get install postgresql postgresql-9.1 postgresql-common

I hope this will help someone in the future to figure it out faster than I did :-)

Solution 2:

I had the same problem, and couldn't fix it by simply removing and re-installing. The problem was related to the fact that postgresql is a metapackage. The fix (as detailed here) was to purge everything using a wildcard:

apt-get --purge remove postgresql\*

and the re-installing.

Solution 3:

I don't mean to be patronizing here, but just create it.

Without an initialized cluster it really is just an empty directory. The most likely thing is that you don't have a cluster created (see what's in /var/lib/postgresql).

You can use (sudo) mkdir /etc/postgresql /etc/postgresql/9.1 to create the directory.

Then use (sudo) pg_createcluster 9.1 main to create your DB cluster (called main). Once created you will have a /etc/postgresql/9.1/main directory with the settings for that cluster.

Once you have your cluster use the (sudo) pg_ctrlcluster 9.1 main start to get the cluster up and running.