2

I wanted to install pgAudit on my CentOS 6 32-bit, I already installed PostgreSQL 10 + pgAdmin4 from PostgreSQL Linux run installer that I downloaded from DBEnterprise

I followed the guide from here, here are the steps I followed :

  1. git clone https://github.com/postgres/postgres.git
  2. go into the folder by cd postgres and then git checkout REL_10_STABLE
  3. ./configure after that make install -s

  4. cd contrib

  5. Clone the pgAudit extension by git clone https://github.com/pgaudit/pgaudit.git
  6. cd pgaudit
  7. git checkout REL_10_STABLE
  8. make -s check
  9. make install

I'm stuck at step 8. Here's the result :

[root@localhost pgaudit]# make -s check
============== creating temporary instance            ==============
============== initializing database system           ==============

pg_regress: initdb failed
Examine /root/postgres/contrib/pgaudit/log/initdb.log for the reason.
Command was: "initdb" -D "/root/postgres/contrib/pgaudit/./tmp_check/data" --no-clean --no-sync > "/root/postgres/contrib/pgaudit/log/initdb.log" 2>&1
make: *** [check] Error 2

I opened the initdb.log at /root/postgres/contrib/pgaudit/log/initdb.log like how it told me to, and it says :

Running in no-clean mode.  Mistakes will not be cleaned up.
initdb: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.

So I tried it again after I logged in as postgres, here's the result :

bash-4.1$ make -s check
make[3]: stat: ../../src/include/utils/errcodes.h: Permission denied
/bin/sh: line 0: cd: utils/: Not a directory
make[3]: *** [../../src/include/utils/errcodes.h] Error 1
make[2]: *** [submake-errcodes] Error 2
make[1]: *** [submake-libpgport] Error 2
make: *** [submake] Error 2

I'm really new to both Linux and PostgreSQL, so I don't know why it failed and what is the solution for this. Thanks in advance!

Jack Doe
  • 31
  • 2
  • 9

1 Answers1

0

Look like your db user not having a login shell.

You can try with:

sudo -u postgres psql template

Or:

sudo -u postgres bash
Erdemaknc
  • 23
  • 5