将 PostgreSQL 从 9.3 升级到 9.4 时如何设置区域设置

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

当我运行:

sudo pg_upgradecluster 9.3 main

我收到这个错误:

> 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

如何更改语言环境来执行此命令?

你需要运行这个:

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

这将解决您的问题。

当您从 Mac 笔记本电脑通过 SSH 连接到 Linux 服务器(包括笔记本电脑上的虚拟 Linux 服务器 运行)时,就会发生这种情况。 SSH 将 LANGLC_* 环境变量从本地 shell 转发到远程 shell,Mac 上使用的某些值在 Mac 上无效Linux 服务器。

可以通过多种方式解决该问题,包括在服务器上安装缺少的语言环境。我建议简单地禁用 SSH 环境转发,要么在服务器上(删除 /etc/ssh/sshd_config 中的 AcceptEnv),要么在笔记本电脑上(删除 /etc/ssh/ssh_config 中的 SendEnv),或两者。

How to fix a locale setting warning from Perl?

中阅读更多内容