无法创build用户postgres:angular色“postgres”不存在

我在Ubuntu的12.04服务器,我想安装postgresql。 截至目前,我已经成功安装,但无法configuration它。 我需要创build一个angular色继续前进,我在terminal中运行这个命令:

root@hostname: createuser -s -r postgres

它说:

createuser: could not connect to database postgres: FATAL: role "root" does not exist

很好,所以我做了:

su - postgres

然后再试一次

postgres@hostname: createuser -s -r postgres

我得到了错误

createuser: could not connect to database postgres: FATAL: role "postgres" does not exist

当我这样做的时候我也遇到了同样的错误

psql -d dbname

它像一个循环,我无法创build一个angular色postgres因为一个angular色postgres不存在。

我该如何解决 ?

postgres版本似乎是9.1.x,而Ubuntu的版本是12.10

原来我在我的机器上安装了postgres-xcpostgresql 。 我不得不彻底关闭postgres-xc。 这样做有点困难,因为总是出现错误--purge remove postgres-xc ,卸载无法继续。

似乎有某种包装错误。 ( 启动板上的细节 )。

最后,我结束了这个工作。

之后,我卸载postgresql并安装回来,使其工作。

阅读postgresql教程 ,不管它是Ubuntu还是其他的Linux。

编辑之前创建角色或其他任何新安装您需要创建数据库集群:你有没有创建它?

 initdb -D /usr/local/pgsql/data 

您需要在Linux机器上以用户postgres身份登录。 这里是更多的信息。