我在Unix上。我已经安装了postgresql-9.3。
当我想使用pg_ctl
或postgres
启动服务器时,终端给我:
如果没有postgresg -xc就不能启动服务器吗?
这一定是您之前安装的postgres-xc
包的残余。
由于您刚刚安装了postgresql-9.3
并且似乎没有使用任何数据库,因此,我建议完全清除所有postgres包。
sudo apt-get purge postgresql-9.2
sudo apt-get purge postgresql-xc
...
直到什么都不剩:
dpkg -l | grep postgres
然后从头开始。您的pg_ctl
实例似乎属于postgres-xc
包。在你卸载了这个包之后,这个应该就没有了。使用以下命令之一查找:
dpkg -S pg_ctl
dlocate pg_ctl
apt-file search pg_ctl
pg_ctlcluster
由postgresql-common
包提供。pg_ctl
由postgresql-9.3
包提供。
您可能遗漏了一些东西。
试题:sudo apt-get install postgresql-client
和sudo apt-get install postgresql postgresql-contrib
关于安装xc的消息是一个无用的,这可能是基于它在xc存储库中扫描的内容。
这里有一个关于这个问题及其解决方案的很好的参考:https://dba.stackexchange.com/questions/72580/missing-the-pg-ctl-package-in-postgres-9-3-installation
由于正常安装postgres时不会将postgres二进制文件放入路径中。
在路径中添加正确的目录可以解决这个问题(暂时)。
PATH=/usr/lib/postgresql/9.3/bin:$PATH
为了使它在我的Ubuntu机器上永久存在,我在/etc/environment中添加了这一行,这使得它对所有用户都有效。
不同的系统设置PATH的正确方法不同,更多信息请参见:
如何在Linux上永久设置$PATH ?
必须安装postgresql-client:
sudo install postgresql-client
尝试在控制台输入以下命令:
sudo -u postgres psql