在Ubuntu 11.04服务器的新副本上,我试图通过apt-get install postgresql来安装PostgreSQL服务器。 但是在安装日志的最后我看到:
Error: could not create default cluster. Please create it manually with pg_createcluster 8.4 main --start
当我运行这个命令时,我看到这个消息:
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US:en", 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.
并没有PostgreSQL服务器启动:(
我需要做些什么才能在这方面变得快乐?
接受的答案并没有帮助我 ; 如果有其他人喜欢我,请阅读下面。
我将问题追溯到pg_upgradecluster明确地pg_upgradecluster LC_ALL 。 这使得Perl失败,无论我与其他环境variables玩的方式。
所以我只是简单地在/usr/bin/pg_upgradecluster注释了第352行:
#delete $ENV{'LC_ALL'};
这个伎俩。 当然,这只有在所有集群中都是具有en_US.UTF-8的平均Joe的情况下才有效,并且不使用任何您需要保留的花式编码。
当前的环境variables也有效果。 使用该命令
locale
看看Postgres看到了什么,并使用export语句进行更新,例如:
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
幸运的是,这是一个我不得不查看我的笔记的问题,但你在2011年9月问过。
检查这些链接 – 获得Google翻译的帮助
http://www.thomas-krenn.com/de/wiki/Perl_warning_Setting_locale_failed_unter_Debian
http://www.thomas-krenn.com/de/wiki/Locales_unter_Ubuntu_konfigurieren
https://help.ubuntu.com/community/Locale#List_current_settings