Hello lad
Hello lad

Reputation: 18790

Cannot use commands 'postgres' or 'pg_ctl'

I am on Unix. I have got postgresql-9.3 installed.
When I want to start the server using pg_ctl or postgres, the terminal gives me:

The program 'postgres' is currently not installed. You can install it by typing:
sudo apt-get install postgres-xc

Can't I start the server without this postgres-xc?

Upvotes: 8

Views: 11689

Answers (4)

artamonovdev
artamonovdev

Reputation: 2380

You must install postgresql-client:

sudo install postgresql-client

Try to enter this command to the console:

sudo -u postgres psql

Upvotes: 0

JKAbrams
JKAbrams

Reputation: 255

Due to reasons a normal install of postgres will not place the postgres binary file in the path.

Adding the right directory to the path solves the problem (temporarily).

PATH=/usr/lib/postgresql/9.3/bin:$PATH

To make it permanent on my Ubuntu machine I added the line to /etc/environment this makes it work for all users.

The correct way to set the PATH is different for different systems, for more info see see:

How to permanently set $PATH on Linux?

Upvotes: 2

Erwin Brandstetter
Erwin Brandstetter

Reputation: 656566

This must be remnants of the postgres-xc package you had installed previously.

Since you just installed postgresql-9.3 and don't seem to have any databases in use, yet, I suggest to completely purge all postgres packages.

sudo apt-get purge postgresql-9.2
sudo apt-get purge postgresql-xc
...

Until there's nothing left:

dpkg -l | grep postgres

Then start from scratch. Your instance of pg_ctl seems to belong to the package postgres-xc. This should be gone after you've uninstalled the package. Find out with one of these commands:

dpkg -S pg_ctl
dlocate pg_ctl
apt-file search pg_ctl

pg_ctlcluster is provided by the package postgresql-common.
pg_ctl is provided by the package postgresql-9.3.

More about starting Postgres in the manual.

Upvotes: 4

ahron
ahron

Reputation: 1372

It is possible you might be missing a few things.

Try: sudo apt-get install postgresql-client and sudo apt-get install postgresql postgresql-contrib

The message about installing xc is a dud, it's probably suggesting that based on what it scanned inside the xc repositories.

Here's a good reference to this problem and its solution: https://dba.stackexchange.com/questions/72580/missing-the-pg-ctl-package-in-postgres-9-3-installation

Upvotes: 0

Related Questions