PostgreSQL服务器无法启动,无法创建锁定文件:权限被拒绝

前端之家收集整理的这篇文章主要介绍了PostgreSQL服务器无法启动,无法创建锁定文件:权限被拒绝前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试安装和运行postgresql服务器,每当我安装它
sudo apt-get install postgresql

我收到以下错误

* Starting Postgresql 9.1 database server                                       
* The Postgresql server Failed to start. Please check the log output:
2014-04-03 17:18:16 PDT FATAL:  could not create lock file     "/var/run/postgresql/.s.PGsql.5432.lock": Permission denied
                                                                    [fail]
invoke-rc.d: initscript postgresql,action "start" Failed.
dpkg: error processing postgresql-common (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql-9.1:
postgresql-9.1 depends on postgresql-common (>= 115~); however:
Package postgresql-common is not configured yet.

dpkg: error processing postgresql-9.1 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql:
 postgresql depends on postgresql-9.1; however:
  Package postgresql-9.1 is not configured yet.

dpkg: error processing postgresql (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a          prevIoUs failure.
Errors were encountered while
 processing:
 postgresql-common
 postgresql-9.1
 postgresql
E: Sub-process /usr/bin/dpkg returned an error code (1)

我猜这是一个权限问题;我该怎么解决呢?
我正在运行Ubuntu 13.10

检查/ var / run / postgresql的所有者,并将其设置为postgres(如果还没有)
要这样做,键入

sudo chown -R postgres:postgres / var / run / postgresql

如果您运行的用户没有sudo权限,那么

1)切换到根

苏 –

2)将/ var / run / postgresql的所有权更改为postgres用户和postgres组

chown -R postgres:postgres / var / run / postgresql

在Ubuntu 14.04上安装postgres时,我也遇到了同样的问题,并改变了我的问题。

猜你在找的Postgre SQL相关文章