Postgresql – After installing postgresql and postgres-xc with apt-get, I have psql but not postgres, initdb, pg_ctl

postgresql-9.1

I used apt-get on Linux Mint to install postgresql and postgres-xc.

I have access to psql, the postgres user exists, it's possible to create databases.

However, the server seems to be running on port 5433 and another process wants it to be on 5432.

I tried to use pg_ctl, postgres, initdb commands to change things, but the prompt says:

[1]postgres :/usr/local/pgsql/data > initdb The program
'initdb' is currently not installed. To run 'initdb' please ask your
administrator to install the package 'postgres-xc'
[127]postgres :/usr/local/pgsql/data > pg_ctl The program
'pg_ctl' is currently not installed. To run 'pg_ctl' please ask your
administrator to install the package 'postgres-xc'

I have already installed postgres-xc. apt-get shows:

The following packages have unmet dependencies: postgres-xc :
Depends: postgres-xc-client but it is not going to be installed E:
Unable to correct problems, you have held broken packages.

However, apt-get seems to get into a cycle of removing postgres packages as follows:

apt-get install postgres-xc-client Reading package lists… Done
Building dependency tree Reading state information… Done The
following package was automatically installed and is no longer
required: libpq-dev Use 'apt-get autoremove' to remove it. Suggested
packages: postgres-xc postgresql-xc-doc The following packages will
be REMOVED: postgresql postgresql-9.1 postgresql-client-9.1
postgresql-client-common postgresql-common postgresql-server-dev-9.1
The following NEW packages will be installed: postgres-xc-client 0
upgraded, 1 newly installed, 6 to remove and 79 not upgraded. Need to
get 0 B/1,572 kB of archives. After this operation, 14.8 MB disk space
will be freed. Do you want to continue [Y/n]? y (Reading database …
181442 files and directories currently installed.) Removing postgresql
… Removing postgresql-9.1 … * Stopping PostgreSQL 9.1 database
server
[ OK ] Removing postgresql-client-9.1 … Removing
postgresql-server-dev-9.1 … Removing postgresql-common … * No
PostgreSQL clusters exist; see "man pg_createcluster" Removing
'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by
postgresql-common' Removing postgresql-client-common … Processing
triggers for man-db … Processing triggers for ureadahead …
Selecting previously unselected package postgres-xc-client. (Reading
database … 180528 files and directories currently installed.)
Unpacking postgres-xc-client (from
…/postgres-xc-client_1.0.2-1ubuntu1_amd64.deb) … Processing
triggers for man-db … Setting up postgres-xc-client (1.0.2-1ubuntu1)

I have read the postgres manual at:
http://www.postgresql.org/docs/9.1/interactive/installation.html

and it warns

(If you are installing a pre-packaged distribution, such as an RPM or Debian package, ignore this chapter and read the packager's instructions instead.)

But I can't find any Debian-based instructions for repairing the broken packages.

Edit for clarity:

I can find general Debian-based suggestions for using apt-get install -f but there seems to be a specific conflict between postgresql and postgres-xc

The following extra packages will be installed: postgresql-9.1
postgresql-client-9.1 postgresql-client-common postgresql-common
Suggested packages: oidentd ident-server locales-all The following
packages will be REMOVED: postgres-xc-client The following NEW
packages will be installed: postgresql postgresql-9.1
postgresql-client-9.1 postgresql-client-common postgresql-common 0
upgraded, 5 newly installed, 1 to remove and 79 not upgraded. Need to
get 0 B/3,319 kB of archives. After this operation, 11.4 MB of
additional disk space will be used. Do you want to continue [Y/n]? n

There doesn't seem to be any document written by anyone who has successfully used apt-get to install postgres.

There is a suggestion for how to delete everything at:

http://www.iasptk.com/ubuntu-debian/15825-ubuntu-fix-broken-package-best-solution

but that doesn't get the software stack working, that just gets rid of old broken stuff without fixing it.

Best Answer

I cannot check how it is in 9.2, but I had this exact same difficulty in 9.3.

The problem is that initdb is installed. It just isn't in your path.

What happens when you run these two commands?

updatedb
locate initdb

That's how I found it. Then, all I had to do was execute :

/usr/lib/postgresql/9.3/bin/initdb

You'll probably find that it's just the same in 9.2.

Related Question