Re: Installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition: Noexisting local cluster is suitable as a default target - Mailing list pgsql-general

From Marco Ippolito
Subject Re: Installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition: Noexisting local cluster is suitable as a default target
Date
Msg-id CAFegzBRjjrzv2mPTi4_dYAZjqvL951CbfRffngnCmmy5jN1QRA@mail.gmail.com
Whole thread Raw
In response to Re: Installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition: No existing local cluster is suitable as a default target  (Andreas Joseph Krogh <andreas@visena.com>)
Responses Re: Installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition: No existing local cluster is suitable as a default target
List pgsql-general
Hi Andreas,
if I understand correctly, this is what I've done afterwards:

postgres@pc:/home/marco$ /usr/lib/postgresql/11/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
waiting for server to start..../bin/sh: 1: cannot create logfile: Permission denied
 stopped waiting
pg_ctl: could not start server
Examine the log output.
postgres@pc:/home/marco$

What am I doing wrong?

Il giorno mer 18 set 2019 alle ore 12:22 Andreas Joseph Krogh <andreas@visena.com> ha scritto:
På onsdag 18. september 2019 kl. 12:13:24, skrev Marco Ippolito <ippolito.marco@gmail.com>:
Thanks Matthias.
 
Followed these steps (indicated here: https://www.postgresql.org/docs/11/creating-cluster.html )
root# chown postgres /usr/local/pgsql
root# su postgres
postgres$ initdb -D /usr/local/pgsql/data
 
postgres@pc:/home/marco$ /usr/lib/postgresql/11/bin/initdb -D /usr/local/pgsql/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locales
  COLLATE:  en_GB.UTF-8
  CTYPE:    en_GB.UTF-8
  MESSAGES: en_GB.UTF-8
  MONETARY: C.UTF-8
  NUMERIC:  C.UTF-8
  TIME:     C.UTF-8
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Europe/Rome
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/lib/postgresql/11/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
 
But now permission denied:
 
postgres@pc:/home/marco$ sudo /usr/lib/postgresql/11/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
[sudo] password for postgres:
postgres is not in the sudoers file.  This incident will be reported.
postgres@pc:/home/marco$ /usr/lib/postgresql/11/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
waiting for server to start..../bin/sh: 1: cannot create logfile: Permission denied
 stopped waiting
pg_ctl: could not start server
Examine the log output.
postgres@pc:/home/marco$
 
Start pg_ctl as postgres user, no need to sudo.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

pgsql-general by date:

Previous
From: Andreas Joseph Krogh
Date:
Subject: Re: Installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition: No existing local cluster is suitable as a default target
Next
From: Andreas Joseph Krogh
Date:
Subject: Re: Installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition: No existing local cluster is suitable as a default target