Postgresql 无法使用命令';博士后';或';pg#u ctl';

Postgresql 无法使用命令';博士后';或';pg#u ctl';,postgresql,installation,Postgresql,Installation,我使用Unix。我已经安装了postgresql-9.3。 当我想使用pg_ctl或postgres启动服务器时,终端会给我: The program 'postgres' is currently not installed. You can install it by typing: sudo apt-get install postgres-xc “postgres”程序当前未安装。您可以通过键入以下内容进行安装: sudo-apt-get-install-postgres-xc 没有这个

我使用Unix。我已经安装了postgresql-9.3。
当我想使用
pg_ctl
postgres
启动服务器时,终端会给我:

The program 'postgres' is currently not installed. You can install it by typing: sudo apt-get install postgres-xc “postgres”程序当前未安装。您可以通过键入以下内容进行安装: sudo-apt-get-install-postgres-xc
没有这个postgres 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
。卸载软件包后,此信息应消失。了解以下信息:

pg_ctlcluster
由包
postgresql common
提供
pg_ctl
由包
postgresql-9.3
提供


您可能遗漏了一些东西

尝试:
sudo apt get安装postgresql客户端
sudo apt get install postgresql postgresql contrib

关于安装xc的信息是无用的,它可能是基于它在xc存储库中扫描的内容

以下是有关此问题及其解决方案的一个很好的参考:
由于某些原因,正常安装postgres不会将postgres二进制文件放置在路径中

将正确的目录添加到路径可以解决问题(暂时)

为了使它在我的Ubuntu机器上永久存在,我在/etc/environment中添加了这一行,这使它适用于所有用户

不同系统设置路径的正确方法不同,有关更多信息,请参阅:

您必须安装postgresql客户端:

sudo安装postgresql客户端

尝试将此命令输入控制台:


sudo-u postgres psql

服务器也可以使用/etc/init.d/postgresql start启动您使用的是哪种“Unix”?在一个相当混乱的服务器上,您的命令dpkg-l | grep postgres可以帮助您了解Ubuntu认为它安装了什么+1.
dpkg -S pg_ctl
dlocate pg_ctl
apt-file search pg_ctl
PATH=/usr/lib/postgresql/9.3/bin:$PATH