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 CAFegzBSHJiiazfjBsNBd-jey9xrTSFrKQQQeAR1W7CZft-161A@mail.gmail.com
Whole thread Raw
In response to Re: Installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition: Noexisting local cluster is suitable as a default target  (Matthias Apitz <guru@unixarea.de>)
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
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$



Il giorno mer 18 set 2019 alle ore 12:03 Matthias Apitz <guru@unixarea.de> ha scritto:
El día Wednesday, September 18, 2019 a las 11:50:45AM +0200, Marco Ippolito escribió:

> I installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition using package
> manager: sudo apt-get install postgresql-11. But now I'm not able to call
> psql:
>
>     (base) marco@pc:~$ sudo su -l postgres
>     [sudo] password for marco:
>     No directory, logging in with HOME=/
>     postgres@pc:/$ psql
>     Warning: No existing local cluster is suitable as a default target.
> Please
>     see man pg_wrapper(1) how to specify one.
>     Error: You must install at least one postgresql-client-<version> package
>     postgres@pc:/$
>
> I tried to specify the port to use but it asks for a postgresql-client:
>
>     (base) marco@pc:~$ sudo -u postgres /usr/bin/psql -p 5432
>     Error: You must install at least one postgresql-client-<version> package
>
> But the latest postgresql-client is already installed:
>
>     (base) marco@pc:~$ sudo apt-get install postgresql-client-11
>     Reading package lists... Done
>     Building dependency tree
>     Reading state information... Done
>     postgresql-client-11 is already the newest version (11.5-1.pgdg18.04+1).
>     0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
>
> How to solve the problem? Looking forward to your kind help.
> Marco

Have you setup and started any PG cluster? See
https://www.postgresql.org/docs/11/runtime.html
(chapter 18. Server Setup and Operation).

        matthias

--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!


pgsql-general by date:

Previous
From: Matthias Apitz
Date:
Subject: Re: Installed PostgreSQL-11 in Ubuntu 18.04.02 Server Edition: Noexisting 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