【发布时间】:2014-07-10 12:59:52
【问题描述】:
我使用 Vagrant 1.5 和标准 Vagrantfile 和 Canonical Ubuntu 12 Box
然后我使用vagrant ssh 登录VM 并执行以下命令:
sudo apt-get install postgresql postgresql-contrib python-psycopg2 -y
sudo -u postgres psql
并得到这样的错误:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
这很奇怪,这个步骤在official docs中有描述。 可能是什么问题?
更新
Postgres 进程在安装后没有立即运行,我用ps -ef | grep postgr 命令检查了它。 sudo service postgresql status 什么也不返回。这是packegs安装的完整日志:https://gist.github.com/AndrewPashkin/2292aa9a53154217ff39
有一些有趣的台词:
Error: The locale requested by the environment is invalid.
Error: could not create default cluster. Please create it manually with
pg_createcluster 9.1 main --start
在我尝试执行此命令后,我得到:
$ pg_createcluster 9.1 main --start
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = "ru_RU.UTF-8",
LC_ADDRESS = "ru_RU.UTF-8",
LC_MONETARY = "ru_RU.UTF-8",
LC_NUMERIC = "ru_RU.UTF-8",
LC_TELEPHONE = "ru_RU.UTF-8",
LC_IDENTIFICATION = "ru_RU.UTF-8",
LC_MEASUREMENT = "ru_RU.UTF-8",
LC_TIME = "ru_RU.UTF-8",
LC_NAME = "ru_RU.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.
所以这是语言环境问题。我已经尝试过的:
sudo apt-get install language-pack-en -y
没有帮助。并且:
sudo update-locale LANG=en_US.UTF-8 LC_MESSAGES=POSIX
失败:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = "ru_RU.UTF-8",
LC_ADDRESS = "ru_RU.UTF-8",
LC_MONETARY = "ru_RU.UTF-8",
LC_NUMERIC = "ru_RU.UTF-8",
LC_TELEPHONE = "ru_RU.UTF-8",
LC_IDENTIFICATION = "ru_RU.UTF-8",
LC_MEASUREMENT = "ru_RU.UTF-8",
LC_TIME = "ru_RU.UTF-8",
LC_NAME = "ru_RU.UTF-8",
LC_MESSAGES = "POSIX",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
【问题讨论】:
-
嗯,它正在运行吗? apt 安装的日志在哪里?显示它正在运行的服务器日志在哪里?您如何期望人们在没有最起码的信息的情况下提供帮助?
-
@RichardHuxton 你的评论实际上让我知道了问题的真正原因 - 仔细查看安装日志发现了一些有用的细节
-
很奇怪。我从未见过像这样混在一起的两个语言环境。尽管如此,这就是日志存在的原因,否则您可能需要花费数天时间才能弄清楚这一点。
标签: postgresql ubuntu cloud ubuntu-12.04 vagrant