0

I'm trying to install PostgreSQL server on a server running debian8.
I installed the package postgresql-9.5 with apt, but it seems like there are missing programs.

I tried to create a cluster but initdb can not be found on the server, I tried as standard user, as postgres and even root.

When I look up /usr/lib/postgresql/9.5/bin/ there is not initdb nor pg_ctl program.

Is there any additionnal package I forgot to install to make it work ?

ibi0tux
  • 161
  • 1
  • 7

1 Answers1

1

initdb is part of the postgresql-9.5 package as provided by pgdg, and it should be located where you don't find it.

$ dpkg -S initdb
postgresql-9.5: /usr/share/locale/it/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/share/locale/zh_CN/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/share/locale/ko/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/share/postgresql/9.5/man/man1/initdb.1.gz
postgresql-9.5: /usr/share/locale/fr/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/lib/postgresql/9.5/bin/initdb
postgresql-9.5: /usr/share/locale/ja/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/share/locale/pt_BR/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/share/locale/cs/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/share/locale/pl/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/share/locale/ru/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/share/locale/de/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/share/locale/sv/LC_MESSAGES/initdb-9.5.mo
postgresql-9.5: /usr/share/locale/es/LC_MESSAGES/initdb-9.5.mo

It's not normal if you don't find initdb in the directory where it should be, so you might want to double check that, and maybe consider reinstalling the package.

But anyway initdb is not meant to be called directly in Debian, which is why it's not in the PATH. Debian packages for postgres come with an abstraction layer on top of all these commands, to allow for several versions of postgres to run simultaneously.

There is an introduction here: https://wiki.debian.org/PostgreSql and details in the manpages for pg_wrapper, pg_ctlcluster, pg_createcluster, ... and a few other pg_* commands.

Also, a default cluster is automatically created when the main postgresql package is installed, so you normally don't even have to create one, and a default database is accessible just after the install by running psql under the postgres account.

Daniel Vérité
  • 2,740
  • 14
  • 19
  • I finally managed to make it work by purging all packets and reinstalling in along with `postgres-contrib` and this time everything worked. – ibi0tux May 03 '16 at 07:10