Issues starting database for the first time on Linux

From: Isaac Braham <isaac(dot)o(dot)braham(at)gmail(dot)com>
To: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Issues starting database for the first time on Linux
Date: 2019-12-04 10:46:59
Message-ID: CAKnAqnDa_kMUh+Uhz36BYMfPNpcKWHY=bK8Mccnc-1+-Rq-xQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I'm following the instructions for setting up Postgres 11 on my Linux
machine. I'm new to database management, and just need to run a postgres
server to link up to a client on another machine, nothing complicated
(hopefully).

I'm following the long version, but will use the short version of the
documentation to describe where I've got to.

./configure
make
su
make install

> All the above was done through the repository installer on Linux (Manjaro).

adduser postgres

> Not sure why or how, but I found a user 'postgres' already existed on my system, so left it there.

mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

> No apparent problem here, the text output ends with "Success. You can now start the database server using: pg_ctl -D /usr/local/pgsql/data -l logfile start"

/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &

>I presume this is a similar instruction to the above (just specifying the path to the binary), either way - nothing I try here works

pg_ctl -D /usr/local/pgsql/data -l logfile start - leads to "waiting
for server to start..../bin/sh: logfile: Permission denied stopped
waiting pg_ctl: could not start server"

/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
- leads to "[1] 2996 [postgres(at)desk ~]$ -bash: logfile: Permission
denied"

postgres -D /usr/local/pgsql/data (starting it in the foreground) - leads to

2019-12-04 10:07:57.604 GMT [3005] LOG: listening on IPv6 address
"::1", port 5432
2019-12-04 10:07:57.604 GMT [3005] LOG: listening on IPv4 address
"127.0.0.1", port 5432
2019-12-04 10:07:57.606 GMT [3005] FATAL: could not create lock file
"/run/postgresql/.s.PGSQL.5432.lock": No such file or directory
2019-12-04 10:07:57.606 GMT [3005] LOG: database system is shut down

Why am I getting permission denied at every turn, I've tried to follow
the instructions to the letter?

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2019-12-04 13:16:46 Re: Issues starting database for the first time on Linux
Previous Message Marcel Ruff 2019-12-03 10:12:36 Re: PostgreSQL 12 crash with segmentation violation in heap_freetuple