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@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?