在Ubuntu 12.04上安装Postgresql 9.2

时间:2013-07-01 07:47:12

标签: postgresql ubuntu ubuntu-12.04 postgresql-9.2

要安装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"

如何解决此问题?

2 个答案:

答案 0 :(得分:27)

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

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

基本上,在/ etc / environment中添加你想要的语言。就我而言:

sudo nano /etc/environment

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

LC_ALL="en_US.utf-8"

然后重启服务器

sudo reboot

答案 1 :(得分:19)

您的系统区域设置配置搞砸了。您的LC_MESSAGES设置为en_IN.UTF-8,但LANG设置为en_US.UTF-8,这很奇怪且不一致。您是否在LC_MESSAGES~/.bash_profile或其他内容中设置了/etc/environment

你真的应该dpkg-reconfigure locales。请参阅how to select and generate locales in Ubuntu

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