Issues starting database for the first time on Linux

Isaac Braham <[email protected]> Wed, 4 Dec 2019 10:46:59 +0000
Newsgroups gmane.comp.db.postgresql.novice
Message-ID <CAKnAqnDa_kMUh+Uhz36BYMfPNpcKWHY=bK8Mccnc-1+-Rq-xQg@mail.gmail.com>
--000000000000e51d840598de8825
Content-Type: text/plain; charset="UTF-8"

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?

--000000000000e51d840598de8825
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I&#39;m following the instructions for setting up Pos=
tgres 11 on my Linux machine. I&#39;m new to database management, and just =
need to run a postgres server to link up to a client on another machine, no=
thing complicated (hopefully).</div><div><br></div><div>I&#39;m following t=
he long version, but will use the short version of the documentation to des=
cribe where I&#39;ve got to.</div><div><br></div><div><pre class=3D"gmail-s=
ynopsis">./configure
make
su
make install<br><span style=3D"font-family:arial,sans-serif"><br></span></p=
re><pre class=3D"gmail-synopsis"><span style=3D"font-family:arial,sans-seri=
f">&gt; All the above was done through the repository installer on Linux (M=
anjaro).</span><br></pre><pre class=3D"gmail-synopsis"><br>adduser postgres=
<br><br><span style=3D"font-family:arial,sans-serif">&gt; Not sure why or h=
ow, but I found a user &#39;postgres&#39; already existed on my system, so =
left it there.</span><br><br>mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres<br>/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data<br><b=
r></pre><pre class=3D"gmail-synopsis"><font face=3D"arial,sans-serif">&gt; =
No apparent problem here, the text output ends with &quot;Success. You can =
now start the database server using: pg_ctl -D /usr/local/pgsql/data -l log=
file start&quot;</font></pre><pre class=3D"gmail-synopsis"><br>/usr/local/p=
gsql/bin/postgres -D /usr/local/pgsql/data &gt;logfile 2&gt;&amp;1 &amp;<br=
><br></pre><pre class=3D"gmail-synopsis"><font face=3D"arial,sans-serif">&g=
t;I presume this is a similar instruction to the above (just specifying the=
 path to the binary), either way - nothing I try here works</font><br></pre=
><pre class=3D"gmail-synopsis">pg_ctl -D /usr/local/pgsql/data -l logfile s=
tart - <span style=3D"font-family:arial,sans-serif">leads to &quot;waiting =
for server to start..../bin/sh: logfile: Permission denied stopped waiting =
pg_ctl: could not start server&quot;</span><br><br>/usr/local/pgsql/bin/pos=
tgres -D /usr/local/pgsql/data &gt;logfile 2&gt;&amp;1 &amp; - <span style=
=3D"font-family:arial,sans-serif">leads to &quot;[1] 2996 [postgres@desk ~]=
$ -bash: logfile: Permission denied&quot;</span><br><br>postgres -D /usr/lo=
cal/pgsql/data (starting it in the foreground) - leads to <br><br>2019-12-0=
4 10:07:57.604 GMT [3005] LOG: =C2=A0listening on IPv6 address &quot;::1&qu=
ot;, port 5432<br>2019-12-04 10:07:57.604 GMT [3005] LOG: =C2=A0listening o=
n IPv4 address &quot;127.0.0.1&quot;, port 5432<br>2019-12-04 10:07:57.606 =
GMT [3005] FATAL: =C2=A0could not create lock file &quot;/run/postgresql/.s=
.PGSQL.5432.lock&quot;: No such file or directory<br>2019-12-04 10:07:57.60=
6 GMT [3005] LOG: =C2=A0database system is shut down<br><br></pre><pre clas=
s=3D"gmail-synopsis"><span style=3D"font-family:arial,sans-serif">Why am I =
getting permission denied at every turn, I&#39;ve tried to follow the instr=
uctions to the letter?</span><br></pre></div></div>

--000000000000e51d840598de8825--