Install postgresql. Why is initdb unavailable?
Solution 1:
You will find initdb
under /usr/lib/postgresql/x.y/bin/
. See also /usr/share/doc/postgresql-common/README.Debian.gz
for more information on the setup on Debian and Ubuntu.
Solution 2:
initdb
is intended to be run under the postgres user account that is created during the install. After installing postgresql you can do:
sudo su - postgres
Then you should be able to run initdb
.
Solution 3:
initdb
is not installed as user executable. Is only installed in /usr/lib/postgresql/X.X/bin/
, because it always depends on the version. initdb
can only be executed from that specific directory.
As mentioned in other answers, installation of postgres creates a default directory that may be in a limited partition. Users may want to change this, but it requires other steps also. see here.