2013-07-01 75 views
10

對於安裝postgresql 9.2我關注了此網址:http://www.ubuntugeek.com/how-to-install-postgresql-9-2-on-ubuntu-server-using-ppa.htmlPostgreSQL的9.2安裝在Ubuntu 12.04

但在安裝輸出的末尾是這樣的:

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" 

我該如何解決這個問題?

回答

19

您的系統語言環境配置已混亂。您的LC_MESSAGES設置爲en_IN.UTF-8,但LANG設置爲en_US.UTF-8,這很奇怪且不一致。您是否在~/.bash_profile/etc/environment或其他地方設置了LC_MESSAGES

你真的應該dpkg-reconfigure locales。見how to select and generate locales in Ubuntu

修復了語言環境設置後,可以使用錯誤建議的pg_wrapper命令pg_createcluster 9.2 main --start創建集羣。之後,開始服務將工作。

+0

這個我安裝SDK6之前,但它並沒有給任何錯誤。那麼爲什麼postgresql給了porblem? –

+0

@NareshJ什麼是「SDK6」?你也許是指「OpenJDK 6 SDK」?答案是,如果您的語言環境配置完全中斷,某些程序不會介意太多。 PostgreSQL的確。 **您需要重新生成語言環境**,以便「en_US.UTF-8」和「en_IN.UTF-8」的語言環境數據實際存在。 –

+2

嘿,謝謝你,我通過完成刪除postgres解決了問題,然後安裝了'language-pack-en-base',然後再次安裝了postgresql。有效。再次感謝您準確指出錯誤。 :) –

27

我嘗試了所有我能找到的解決方案,但最終這個職位分類是:

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

基本上,添加要在/ etc /環境的語言。在我的情況:

sudo nano /etc/environment 

然後將此添加到該文件的末尾:

LC_ALL="en_US.utf-8" 

然後重新啓動服務器

sudo reboot 
+1

偉大的,爲我工作! –

+1

它也適用於我。 –

+1

謝謝你,效果很好 – rusllonrails