Discussion:
Where was my app installed?
(too old to reply)
David
2024-08-23 05:30:01 UTC
Permalink
After installing PostgreSQL [...]
Hi, we dont know what 'installing' means for you.
From where did you obtain the software?
What command did you run to install it?

What output did it produce while it was installing?
Mike
2024-08-23 05:40:01 UTC
Permalink
After installing PostgreSQL on my Debian-12 machine
Is there a way I can locate the installation directory?
Assuming that you installed the `postgresql` package. Try:

dpkg -L postgresql
d***@howorth.org.uk
2024-08-23 10:10:02 UTC
Permalink
After installing PostgreSQL on my Debian-12 machine, I typed
*bash: postgres: command not found*
*psql (PostgreSQL) 16.3 (Debian 16.3-1.pgdg120+1)*
Obviously postgres is not in the path, but I don't know where the
'apt-get' installed it or why it did not add it to the path.
Is there a way I can locate the installation directory?
Thank in advance.
It sounds like you may have installed the client but not the server. So
as already requested, please detail exactly what you did, unless you
can work out the solution yourself now.
The Wanderer
2024-08-23 11:30:01 UTC
Permalink
After installing PostgreSQL on my Debian-12 machine, I typed
'postgres --version' and got this msg: *bash: postgres: command not
found*
$ dlocate postgres | grep postgres$
postgresql-13: /usr/lib/postgresql/13/bin/postgres
postgresql-13: /usr/lib/postgresql/13/lib/bitcode/postgres
python3-jedi:
/usr/lib/python3/dist-packages/jedi/third_party/django-stubs/django-stubs/contrib/postgres
postgresql-14: /usr/lib/postgresql/14/bin/postgres
postgresql-14: /usr/lib/postgresql/14/lib/bitcode/postgres
fpc-source-3.2.2: /usr/share/fpcsrc/3.2.2/packages/fcl-db/src/sqldb/postgres
fpc-source-3.2.2: /usr/share/fpcsrc/3.2.2/packages/postgres
postgresql-15: /usr/lib/postgresql/15/bin/postgres
postgresql-15: /usr/lib/postgresql/15/lib/bitcode/postgres
postgresql-16: /usr/lib/postgresql/16/bin/postgres
postgresql-16: /usr/lib/postgresql/16/lib/bitcode/postgres

That command won't work for you unless you have 'dlocate' installed and
'update-dlocatedb' has run since you installed the package with the file
you're looking for.

The paths above may give you a hint of where to look, however.
*psql (PostgreSQL) 16.3 (Debian 16.3-1.pgdg120+1)*
Obviously postgres is not in the path, but I don't know where the
'apt-get' installed it or why it did not add it to the path.
The directories for the above binaries aren't in $PATH for me, either -
not as my normal user, nor as root.

But I also don't *need* them to be. Those binaries appear to be for the
server; the server is started automatically, in my case apparently from
/etc/init.d/postgresql, in your case most likely by a systemd service of
some type. I've been running postgresql for years, and I don't think
I've ever actually *looked* for the server binaries before (although I
*have* manually run some of the other binaries from the same directory,
back when I was initially migrating from MariaDB).

If you do need to be able to manually launch the server for some reason,
you can just add the relevant directory (found as above) to your PATH
environment variable - or, of course, run it with full path.


My guess as to why the server binaries are not installed into the PATH
location(s) is that it's about coinstallability. As you can see above, I
have multiple postgresql versions installed (although in my case I think
that's due to inertia, not to any actual need for the older versions);
the only way to do that without embedding the version number into the
name of every file involved is to have the versions installed into
different directories, and of course those multiple directories won't
all be in $PATH.

That said, the same is true of the client, and the client does add a
symlink which eventually gets resolved to the correct version. There's
no reason the same couldn't be done for the server; my guess as to the
reason why it *isn't* done is that it's a combination of "there's little
reason for the user to need to run these binaries manually" with a
desire to keep the install relatively self-contained, so that it's easy
to tell each version's binaries where to find the libraries for that
version, et cetera.
Is there a way I can locate the installation directory?
I hope this was helpful.
--
The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. -- George Bernard Shaw
t***@tuxteam.de
2024-08-23 20:50:01 UTC
Permalink
After installing PostgreSQL on my Debian-12 machine, I typed 'postgres
*bash: postgres: command not found*
There is *no* command named postgres in the Postgresql installation. Not
in the client, not in the server parts.

There /is/ a postgres command in the postgresql-autodoc package:

***@caliban:~$ apt-file search /usr/bin/postgres
postgresql-autodoc: /usr/bin/postgresql_autodoc

but this one quite possibly doesn't do what you think it does.

What would you expect the command "postgres" to do?

Cheers
--
t
The Wanderer
2024-08-23 21:00:01 UTC
Permalink
Post by t***@tuxteam.de
After installing PostgreSQL on my Debian-12 machine, I typed 'postgres
*bash: postgres: command not found*
There is *no* command named postgres in the Postgresql installation. Not
in the client, not in the server parts.
Then... what is /usr/lib/postgresql/$VERSION/bin/postgres ?

On my machine, that exists (for values of $VERSION of 13, 14, 15, and
16), and 'file' reports it as being an ELF executable binary.

It's not in $PATH, but I don't think I'd use that as the deciding factor
for whether or not something qualifies as a command.
Post by t***@tuxteam.de
What would you expect the command "postgres" to do?
The one I see appears, from what I can determine based on examining the
init.d script and the file it sources, to be the server binary itself.
--
The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. -- George Bernard Shaw
t***@tuxteam.de
2024-08-23 21:10:02 UTC
Permalink
Post by The Wanderer
Post by t***@tuxteam.de
After installing PostgreSQL on my Debian-12 machine, I typed 'postgres
*bash: postgres: command not found*
There is *no* command named postgres in the Postgresql installation. Not
in the client, not in the server parts.
Then... what is /usr/lib/postgresql/$VERSION/bin/postgres ?
It's a binary, but I wouldn't call it a "command" in the usual
sense (it would live in some of the customary $PATH places, then).

IIRC (but I might be wrong) postgres is instantiated to handle a
session and should be started by postmaster. I don't think it expects
to be called directly.

[...]
Post by The Wanderer
It's not in $PATH, but I don't think I'd use that as the deciding factor
for whether or not something qualifies as a command.
Hm. That's exactly what I just did,

Cheers
--
t
The Wanderer
2024-08-23 21:40:02 UTC
Permalink
Post by The Wanderer
Post by t***@tuxteam.de
There is *no* command named postgres in the Postgresql
installation. Not in the client, not in the server parts.
Then... what is /usr/lib/postgresql/$VERSION/bin/postgres ?
It's a binary, but I wouldn't call it a "command" in the usual sense
(it would live in some of the customary $PATH places, then).
Post by The Wanderer
It's not in $PATH, but I don't think I'd use that as the deciding
factor for whether or not something qualifies as a command.
Hm. That's exactly what I just did,
That would be the difference between us on the subject, then. I was
surprised by the statement, because of that difference in definitions.
IIRC (but I might be wrong) postgres is instantiated to handle a
session and should be started by postmaster. I don't think it
expects to be called directly.
It probably won't be called directly, indeed, unless you're specifically
launching the server manually for some reason (e.g. testing-related).
--
The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. -- George Bernard Shaw
Loading...