远程服务器上的Postgres区域设置错误

时间:2015-10-14 17:22:11

标签: ruby-on-rails postgresql ubuntu locale

我正在使用来自Digital Ocean的远程服务器设置Ubuntu 14.04,Rails并且我遇到了缺少区域设置的问题。我已经搜索了这个问题,并尝试过那些对我不起作用的问题。

实施例

sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales 

尝试创建新的Postgres用户时收到错误

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")

我的-locale设置

locale: Cannot set LC_CTYPE to default locale: No such file or   directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

2 个答案:

答案 0 :(得分:1)

似乎您的LANGUAGE未设置。

你可以尝试

export LANGUAGE="en_US.UTF-8"
echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale

这是关于如何configure locale in Ubuntu的好文章。

编辑:我现在注意到它是关于数字海洋的。尝试编辑环境

gksudo gedit /etc/environment

并添加LANGUAGE="en_US.UTF-8"LC_ALL="en_US.UTF-8"。我希望它会有所帮助。

答案 1 :(得分:0)