postgresql安装失败与apt-get

我在AWS Ubuntu映像上运行。

在尝试设置我的机器时,我使用apt-get来添加和删除PostgreSql及其一些模块。

现在,当我运行sudo apt-get install postgresql-9.3我得到以下错误:

 Setting up postgresql-9.3 (9.3.10-0ubuntu0.14.04) ... update-alternatives: using /usr/share/postgresql/9.3/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode * Starting PostgreSQL 9.3 database server * Error: could not exec /usr/lib/postgresql/9.3/bin/pg_ctl /usr/lib/postgresql/9.3/bin/pg_ctl start -D /var/lib/postgresql/9.3/main -s -o -c config_file="/etc/postgresql/9.3/main/postgresql.conf" : No such file or directory 

唯一缺less的文件/目录是/var/lib/postgresql/9.3/main

我试过了:

  1. 添加目录
  2. 使用sudo apt-get remove postgresql-9.3并重新安装

错误仍然发生。

我究竟做错了什么? 我怎样才能解决这个问题?

我的理解是,您在卸载时删除了群集,并且不会自动重新创build。

重新创build群集应解决问题:

 mkdir /var/lib/postgresql/9.3/main chown postgres /var/lib/postgresql/9.3/main su postgres /usr/lib/postgresql/9.3/bin/pg_ctl -D /var/lib/postgresql/9.3/main initdb 

您可能需要用在Ubuntu上使用的数据库用户帐户replacepostgres

查看postgres手册了解更多信息: http : //www.postgresql.org/docs/current/static/creating-cluster.html