Search code examples
postgresqlperlvagrantlocale

How to set locale settings while upgrading PostgreSQL from 9.3 to 9.4


When I run:

sudo pg_upgradecluster 9.3 main

I'm getting this error:

> perl: warning: Falling back to the standard locale ("C"). perl:
> warning: Setting locale failed. perl: warning: Please check that your
> locale settings:  LANGUAGE = (unset),     LC_ALL = (unset),   LC_CTYPE =
> "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. Error: Could not create target cluster

How could change the locale to perform this command?


Solution

  • You need to run this:

    aptitude install language-pack-es-base
    locale-gen
    ​
    export LANGUAGE=en_US.UTF-8
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
    locale-gen en_US.UTF-8
    dpkg-reconfigure locales
    ​
    echo LANGUAGE=en_US.UTF-8 > /etc/default/locale
    echo LANG=en_US.UTF-8 >> /etc/default/locale
    echo export LC_ALL=en_US.UTF-8 >> /etc/default/locale
    

    This will solve your issue.