Skip to content
jonranes edited this page Feb 2, 2016 · 9 revisions

Install on Centos 6.5 might go something like below. You will also need to put Graylog on the same machine (127.0.0.1) and probably forward the logs from there to your main Graylog server.

su - 
mkdir /usr/local/pg-bdr-audit-build-source
chown -R postgres.postgres /usr/local/pg-bdr-audit-build-source

yum -y groupinstall "Development tools"
yum install -y bison-devel readline-devel zlib-devel openssl-devel wget git

su - postgres
cd /usr/local/pg-bdr-audit-build-source

git clone -b bdr-pg/REL9_4_STABLE git://git.postgresql.org/git/2ndquadrant_bdr.git postgresql-bdr
git clone -b bdr-plugin/REL0_9_STABLE git://git.postgresql.org/git/2ndquadrant_bdr.git bdr-plugin
git clone https://github.com/jonranes/pgaudit.git pgaudit
git clone https://github.com/bagder/curl.git curl
exit

--install postgres
cd /usr/local/pg-bdr-audit-build-source/postgresql-bdr
./configure --prefix=/usr/pgsql-9.4 --with-openssl
su - postgres
cd /usr/local/pg-bdr-audit-build-source/postgresql-bdr
make -j4 -s
exit
make install

--install bdr plugin
su - postgres
cd /usr/local/pg-bdr-audit-build-source/bdr-plugin
PATH=/usr/pgsql-9.4/bin:"$PATH" ./configure
make -j4 -s all
exit
cd /usr/local/pg-bdr-audit-build-source/bdr-plugin
make -s install
chown -R postgres.postgres /usr/pgsql-9.4

--install contrib
su - postgres
cd /usr/local/pg-bdr-audit-build-source/postgresql-bdr/contrib
make all
exit
cd /usr/local/pg-bdr-audit-build-source/postgresql-bdr/contrib
make -s install

--copy in pgaudit 
su - postgres
cd /usr/local/pg-bdr-audit-build-source/
cp -R pgaudit /usr/local/pg-bdr-audit-build-source/postgresql-bdr/contrib/

--setup curl
yum -y install curl-devel

--build curl
su - postgres
cd /usr/local/pg-bdr-audit-build-source/curl
./buildconf
cd /usr/local/pg-bdr-audit-build-source/curl/include/curl/
mv curlbuild.h.dist curlbuild.h

--copy curl into includes
cd /usr/local/pg-bdr-audit-build-source/
cp -R curl /usr/local/pg-bdr-audit-build-source/postgresql-bdr/include/
exit 

--install pgaudit
chown -R postgres.postgres /usr/local/pg-bdr-audit-build-source/*
su - postgres
cd /usr/local/pg-bdr-audit-build-source/postgresql-bdr/contrib/pgaudit
--replace yourservername in gelfoutput.c in int* post_gelf
make 
exit
cd /usr/local/pg-bdr-audit-build-source/postgresql-bdr/contrib/pgaudit
make install

su - postgres
mkdir /var/lib/pgsql/9.4-bdr
mkdir /var/lib/pgsql/9.4-bdr/data
/usr/pgsql-9.4/bin/initdb /var/lib/pgsql/9.4-bdr/data
exit
service postgresql-9.4 start

su -c "chmod a+x /etc/rc.d/init.d/postgresql-9.4"

export PATH=/usr/pgsql-9.4/bin:$PATH

su - postgres
psql
\password postgres
\q
pickapassword
service postgresql-9.4 start


CREATE EXTENSION pgaudit;
service postgresql-9.4 stop
service postgresql-9.4 start
Clone this wiki locally