Thread: Where is my app installed?

Where is my app installed?

From
Arbol One
Date:

After installing PostgreSQL on my Debian-12 machine, I typed 'postgres --version' and got this msg:
bash: postgres: command not found

'psql --version', however, does work and gives me this message :

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.

--
ArbolOne.ca Using Fire Fox and Thunderbird. ArbolOne is composed of students and volunteers dedicated to providing free services to charitable organizations. ArbolOne on Java Development is in progress [ í ]

Re: Where is my app installed?

From
Adrian Klaver
Date:
On 8/22/24 17:36, Arbol One wrote:
> After installing PostgreSQL on my Debian-12 machine, I typed 'postgres 
> --version' and got this msg:
> *bash: postgres: command not found*
> 
> 'psql --version', however, does work and gives me this message :
> 
> *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?


As to where the  postgres command is:


ls -al /usr/lib/postgresql/16/bin/

[...]
-rwxr-xr-x 1 root root 10338808 Aug  7 06:13 postgres*
[...]

Why do you want to use postgres directly?

> 
> Thank in advance.
> 
> -- 
> */ArbolOne.ca/* Using Fire Fox and Thunderbird. ArbolOne is composed of 
> students and volunteers dedicated to providing free services to 
> charitable organizations. ArbolOne on Java Development is in progress [ í ]

-- 
Adrian Klaver
adrian.klaver@aklaver.com




Re: Where is my app installed?

From
Alan Hodgson
Date:
On Thu, 2024-08-22 at 20:36 -0400, Arbol One wrote:
 
After installing PostgreSQL on my Debian-12 machine, I typed 'postgres --version' and got this msg:
 bash: postgres: command not found
 
'psql --version', however, does work and gives me this message :
 
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.
 
 

find / -name postgres

or

dpkg-query -L postgresql-16 | grep 'bin/postgres$'

You wouldn't normally invoke the server from the command line, so it doesn't need to be in anyone's path.

Re: Where is my app installed?

From
Tom Lane
Date:
Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 8/22/24 17:36, Arbol One wrote:
>> After installing PostgreSQL on my Debian-12 machine, I typed 'postgres 
>> --version' and got this msg:
>> *bash: postgres: command not found*
>> 'psql --version', however, does work and gives me this message :
>> *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.

> As to where the  postgres command is:
> ls -al /usr/lib/postgresql/16/bin/

Theory 1: postgres is packaged in a "postgresql-server" package
and the OP only installed the base (client-side) package.

Theory 2: postgres is installed into some directory not in the OP's
PATH, such as /usr/sbin.  Since it's primarily used as a daemon,
this'd be a reasonable thing for a packager to do.

I'd bet a nickel on #1, though, because I've not seen too many
packagers put postgres somewhere other than where they put psql.
"Separate server package" is extremely common though.

            regards, tom lane



Re: Where is my app installed?

From
Adrian Klaver
Date:
On 8/22/24 19:21, Tom Lane wrote:
> Adrian Klaver <adrian.klaver@aklaver.com> writes:
>> On 8/22/24 17:36, Arbol One wrote:
>>> After installing PostgreSQL on my Debian-12 machine, I typed 'postgres
>>> --version' and got this msg:
>>> *bash: postgres: command not found*
>>> 'psql --version', however, does work and gives me this message :
>>> *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.
> 
>> As to where the  postgres command is:
>> ls -al /usr/lib/postgresql/16/bin/
> 
> Theory 1: postgres is packaged in a "postgresql-server" package
> and the OP only installed the base (client-side) package.
> 
> Theory 2: postgres is installed into some directory not in the OP's
> PATH, such as /usr/sbin.  Since it's primarily used as a daemon,
> this'd be a reasonable thing for a packager to do.

Yes in:

ls -al /usr/lib/postgresql/16/bin/

> 
> I'd bet a nickel on #1, though, because I've not seen too many
> packagers put postgres somewhere other than where they put psql.
> "Separate server package" is extremely common though.

Correct. The missing part is that in Debian/Ubuntu packaging when you 
use psql you are actually doing:

ls -al /usr/bin/psql
lrwxrwxrwx 1 root root 37 Aug  8 07:37 /usr/bin/psql -> 
../share/postgresql-common/pg_wrapper

The Debian packaging routes most things through 
pg_wrapper/postgresql-common a Perl script that does the magic of 
finding the correct binaries for each Postgres version.

> 
>             regards, tom lane

-- 
Adrian Klaver
adrian.klaver@aklaver.com




Re: Where is my app installed?

From
Muhammad Ikram
Date:
Hi Arbol,

Try to find any binary  e.g.

find /usr -name pg_ctl
/usr/local/pgsql/bin/pg_ctl
/usr/lib/postgresql/16/bin/pg_ctl

 find /usr -name psql
/usr/bin/psql
/usr/local/pgsql/bin/psql
/usr/lib/postgresql/16/bin/psql


Later you may create a symlink or add in PATH.
Hope this helps.


Regards,
Ikram




On Fri, Aug 23, 2024 at 7:43 AM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 8/22/24 19:21, Tom Lane wrote:
> Adrian Klaver <adrian.klaver@aklaver.com> writes:
>> On 8/22/24 17:36, Arbol One wrote:
>>> After installing PostgreSQL on my Debian-12 machine, I typed 'postgres
>>> --version' and got this msg:
>>> *bash: postgres: command not found*
>>> 'psql --version', however, does work and gives me this message :
>>> *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.
>
>> As to where the  postgres command is:
>> ls -al /usr/lib/postgresql/16/bin/
>
> Theory 1: postgres is packaged in a "postgresql-server" package
> and the OP only installed the base (client-side) package.
>
> Theory 2: postgres is installed into some directory not in the OP's
> PATH, such as /usr/sbin.  Since it's primarily used as a daemon,
> this'd be a reasonable thing for a packager to do.

Yes in:

ls -al /usr/lib/postgresql/16/bin/

>
> I'd bet a nickel on #1, though, because I've not seen too many
> packagers put postgres somewhere other than where they put psql.
> "Separate server package" is extremely common though.

Correct. The missing part is that in Debian/Ubuntu packaging when you
use psql you are actually doing:

ls -al /usr/bin/psql
lrwxrwxrwx 1 root root 37 Aug  8 07:37 /usr/bin/psql ->
../share/postgresql-common/pg_wrapper

The Debian packaging routes most things through
pg_wrapper/postgresql-common a Perl script that does the magic of
finding the correct binaries for each Postgres version.

>
>                       regards, tom lane

--
Adrian Klaver
adrian.klaver@aklaver.com





--
Muhammad Ikram

Re: Where is my app installed?

From
Adrian Klaver
Date:
On 8/22/24 21:57, Muhammad Ikram wrote:
> Hi Arbol,
> 
> Try to find any binary  e.g.
> 
> find /usr -name pg_ctl
> /usr/local/pgsql/bin/pg_ctl
> /usr/lib/postgresql/16/bin/pg_ctl
> 
>   find /usr -name psql
> /usr/bin/psql
> /usr/local/pgsql/bin/psql
> /usr/lib/postgresql/16/bin/psql
> 
> 
> Later you may create a symlink or add in PATH.
> Hope this helps.

No what you want to do is read:

man pg_wrapper

and the other Debian specific commands

man pg_lscluster, pg_ctlcluster, pg_dropcluster, etc.

Learn what the packaging provides instead of fighting it.

> 
> 
> Regards,
> Ikram
> 
> 
> 
> 

> Muhammad Ikram
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




Re: Where is my app installed?

From
Arbol One
Date:

Thanks everyone, the issue was resolved.

--
ArbolOne.ca Using Fire Fox and Thunderbird. ArbolOne is composed of students and volunteers dedicated to providing free services to charitable organizations. ArbolOne on Java Development is in progress [ í ]