You just need to complete the following steps in the tutorial to successfully start postgresql
:
# mkdir /var/postgresql/data
# chown _postgresql:_postgresql /var/postgresql/data
# su -l _postgresql
$ initdb -D /var/postgresql/data
The files belonging to this database system will be owned by user "_postgresql".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 20
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: 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:
pg_ctl -D /var/postgresql/data -l logfile start
You can start using the command printed by initdb
, but better is to exit
the user session and use what the tutorial recommends:
# rcctl start postgresql
Be sure to carefully follow the rest of the tutorial, or postgresql
won't start after a reboot.