Re: Installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition: No existing local cluster is suitable as a default target

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Matthias Apitz <guru(at)unixarea(dot)de>
Cc: Marco Ippolito <ippolito(dot)marco(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition: No existing local cluster is suitable as a default target
Date: 2019-09-18 14:59:12
Message-ID: ce3d3e0d-93d4-5db2-68f0-3b07f16691f5@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/18/19 7:49 AM, Matthias Apitz wrote:
> El día miércoles, septiembre 18, 2019 a las 07:41:41a. m. -0700, Adrian Klaver escribió:
>
>> On 9/18/19 6:13 AM, Marco Ippolito wrote:
>>> Thanks Matthias,
>>> very kind. Hopefully I will get some hints on how to solve my problem.
>>
>> You should probably take a look at:
>>
>> https://help.ubuntu.com/lts/serverguide/postgresql.html
>>
>> FYI, you should set the permission son /usr/lib/postgresql back to root
>> and use:
>>
>> sudo pg_ctl <command>
>
> NAK. In my understanding, the dir above the data dir of the cluster
> should be owned by 'postgres' and the pg_ctl run as 'postgres':

>
> # mkdir /data/postgresql11
> # chown postgres /data/postgresql11
> # su - postgres
> $ LANG=de_DE.UTF-8 export LANG
> $ /usr/local/sisis-pap/pgsql/bin/pg_ctl -D /data/postgresql11/data initdb
>
> This is stolen from the pages mentioned, i.e. https://www.postgresql.org/docs/11/runtime.html
> (chapter 18. Server Setup and Operation) and worked out of the box fine
> for me.

Its a recommendation and not what the Debian/Ubuntu packaging does.
From a Ubuntu 16.04.6 LTS install:

aklaver(at)arkansas:~$ ls -al /usr/lib/postgresql/
total 24
drwxr-xr-x 4 root root 4096 May 24 09:57 .
drwxr-xr-x 49 root root 12288 Mar 5 2019 ..
drwxr-xr-x 4 root root 4096 Mar 17 2018 10
drwxr-xr-x 4 root root 4096 Oct 20 2018 11

aklaver(at)arkansas:~$ l /var/lib/postgresql/
total 32
drwxr-xr-x 6 postgres postgres 4096 May 29 13:26 ./
drwxr-xr-x 41 root root 4096 May 24 09:47 ../
drwxr-xr-x 3 postgres postgres 4096 Mar 17 2018 10/
drwxr-xr-x 3 postgres postgres 4096 Oct 20 2018 11/
-rw------- 1 postgres postgres 120 May 24 15:07 .bash_history
drwx------ 2 postgres postgres 4096 May 24 15:07 .cache/
-rw-rw-r-- 1 postgres postgres 0 May 29 13:27 cat
-rw------- 1 postgres postgres 90 Feb 11 2017 .psql_histor

From local source install:

postgres(at)tito:~> l /usr/local/pgsql11
total 28
drwxr-xr-x 7 root root 4096 Jan 4 2019 ./
drwxr-xr-x 18 root root 4096 Jul 6 13:54 ../
drwxr-xr-x 2 root root 4096 Aug 26 17:41 bin/
drwx------ 20 postgres postgres 4096 Sep 18 06:27 data/
drwxr-xr-x 6 root root 4096 Aug 26 17:41 include/
drwxr-xr-x 4 root root 4096 Sep 11 07:38 lib64/
drwxr-xr-x 6 root root 4096 Aug 26 17:41 share/

As long as the data directory is owned by postgres all is good.

>
> matthias
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-09-18 15:01:03 Re: Pg_auto_failover
Previous Message Sonam Sharma 2019-09-18 14:56:32 Re: Pg_auto_failover