6

I'm surprised that installing postgresql on ubuntu doesn't give me a working postgres server setup immediately: it requires additional steps:

Setting up postgresql-common (154) ...
 * No PostgreSQL clusters exist; see "man pg_createcluster"
Setting up postgresql-9.3 (9.3.4-1) ...
update-alternatives: using /usr/share/postgresql/9.3/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
 * No PostgreSQL clusters exist; see "man pg_createcluster"
Setting up postgresql (9.3+154) ...

I've seen similar behaviour in the past, where the installer failed to create a default cluster (I thing) because some locale setting was missing but I think I have these setup correctly.

Is it new (and therefore correct) that an additional step is required on Ubuntu 14.04? Or is something (silently) broken?

All of this is happening on a fresh DigitalOcean 14.04 VPS.

5

Problems that occur appear on the system locale

 warning: Please check that your locale settings:
  LANGUAGE = (unset),
  LC_ALL = (unset),
  LC_TIME = "en_US.UTF-8",
  LC_MONETARY = "en_US.UTF-8",
  LC_ADDRESS = "en_US.UTF-8",
  LC_TELEPHONE = "en_US.UTF-8",
  LC_NAME = "en_US.UTF-8",
  LC_MEASUREMENT = "en_US.UTF-8",
  LC_IDENTIFICATION = "en_US.UTF-8",
  LC_NUMERIC = "en_US.UTF-8",
  LC_PAPER = "en_US.UTF-8",
  LANG = "en_US.UTF-8"
     are supported and installed on your system.

The first step to configure the reset locale with the command :

  $ sudo dpkg-reconfigure locales

However postgresql can not be executed, because the current Postgres install clusters are not made.

Then run the command :

  $ sudo pg_createcluster 9.3 main --start
  • Note : I use version postgresql-9.3

Next run postgresql with the command :

  $ sudo service postgresql start
   ## Or
  $ sudo /etc/init.d/postgresql start

The results are as below

  $ sudo service postgresql start
    * Starting PostgreSQL 9.3 database server

Check the status postgresql running or not

  $ sudo service postgresql status
    9.3/main (port 5432): online
| improve this answer | |
1

Today I was playing with Ubuntu 14.04 and face the same problem - but in my case I was adopting my puppet manifests. In any case, the problem was the same: when I was expected to find config file under /etc/postgresql/9.3/main/postgresql.conf it was missing. After some time I found the root of my problem: for some reason locale of Vagrant box I was using (actually, ubuntu/trusty64) was misconfigured and during install I saw such a messages:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_TIME = "ru_RU.UTF-8",
        LC_MONETARY = "ru_RU.UTF-8",
        LC_ADDRESS = "ru_RU.UTF-8",
        LC_TELEPHONE = "ru_RU.UTF-8",
        LC_NAME = "ru_RU.UTF-8",
        LC_MEASUREMENT = "ru_RU.UTF-8",
        LC_IDENTIFICATION = "ru_RU.UTF-8",
        LC_NUMERIC = "ru_RU.UTF-8",
        LC_PAPER = "ru_RU.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory

And at the end of installation:

Unpacking postgresql (9.3+154) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up libpq5 (9.3.5-0ubuntu0.14.04.1) ...
Setting up postgresql-client-common (154) ...
Setting up postgresql-client-9.3 (9.3.5-0ubuntu0.14.04.1) ...
update-alternatives: using /usr/share/postgresql/9.3/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up ssl-cert (1.0.33) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up postgresql-common (154) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Adding user postgres to group ssl-cert

Creating config file /etc/logrotate.d/postgresql-common with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
 * No PostgreSQL clusters exist; see "man pg_createcluster"
Processing triggers for ureadahead (0.100.0-16) ...
Setting up postgresql-9.3 (9.3.5-0ubuntu0.14.04.1) ...
Error: The locale requested by the environment is invalid.
Error: could not create default cluster. Please create it manually with

  pg_createcluster 9.3 main --start

or a similar command (see 'man pg_createcluster').
update-alternatives: using /usr/share/postgresql/9.3/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
 * No PostgreSQL clusters exist; see "man pg_createcluster"
Setting up postgresql (9.3+154) ...
Processing triggers for libc-bin (2.19-0ubuntu6.5) ...

After fixing locale with such a command sudo locale-gen ru_RU ru_RU.UTF-8 ru_RU ru_RU.UTF-8 before installing postgresql the problem gone. Hope it would help someone in future or me from the future.

| improve this answer | |
0

Use pg_createcluster version clustername to create a new cluster. This will create a folder called version under /etc/postgresql containing a folder called clustername which will contain the database configuration files for your new cluster: environment, pg_ctl.conf, pg_hba.conf, pg_ident.conf, postgresql.conf, start.conf. Replace clustername with your preferred cluster name.

| improve this answer | |
  • This is a required step in 14.04? There's no way to have it create the cluster automatically? Currently my ansible deploy fail on this and I'd like to avoid an ugly "raw" command to setup the cluster – Ivo van der Wijk Apr 27 '14 at 8:17

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.