10

为了安装postgresql 9.2,我遵循了这个网址:http ://www.ubuntugeek.com/how-to-install-postgresql-9-2-on-ubuntu-server-using-ppa.html

但在安装输出结束时是这样的:

Setting up postgresql-common (140~precise) ...
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Adding user postgres to group ssl-cert
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
 * No PostgreSQL clusters exist; see "man pg_createcluster"
Setting up postgresql-9.2 (9.2.4-0ppa1~precise) ...
Error: The locale requested by the environment is invalid.
Error: could not create default cluster. Please create it manually with

  pg_createcluster 9.2 main --start

or a similar command (see 'man pg_createcluster').
update-alternatives: using /usr/share/postgresql/9.2/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"
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

当我尝试启动 postgresql 时,出现以下错误:

sudo /etc/init.d/postgresql start
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_MESSAGES = "en_IN.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
 * No PostgreSQL clusters exist; see "man pg_createcluster"

我该如何解决这个问题?

4

2 回答 2

27

我尝试了所有我能找到的解决方案,但最后这篇文章对它进行了排序:

http://ubuntuforums.org/showthread.php?t=1720356

基本上,将您想要的语言添加到 /etc/environment。就我而言:

sudo nano /etc/environment

然后将其添加到文件末尾:

LC_ALL="en_US.utf-8"

然后重启服务器

sudo reboot
于 2013-11-22T05:13:07.310 回答
19

您的系统语言环境配置搞砸了。您LC_MESSAGES设置为en_IN.UTF-8LANG设置en_US.UTF-8为奇怪且不一致。你设置LC_MESSAGES在你的~/.bash_profile/etc/environment还是什么?

你真的应该dpkg-reconfigure locales。了解如何在 Ubuntu 中选择和生成语言环境

修复区域设置后,您可以使用错误提示的pg_wrapper命令pg_createcluster 9.2 main --start来创建集群。之后,启动服务将起作用。

于 2013-07-01T07:51:39.587 回答