Setup Accounting Database

From JonDonym Wiki
Jump to: navigation, search

En2.png De2.png    <- prev | Content | next ->

Setup Accounting Database

If you run payment mixes you have to initialize the Postgres database additionally. It is only needed for the first mix but you do not know if you may not switch the position some time and therefore other mixes should do that as well.

First switch to user postgres.

su postgres

Afterwards create the new user aiuser and the accounting database.

createuser -A -D aiuser
createdb -O aiuser aidb

Log into the database environment as user postgres, set the password for aiuser and leave the database environment.

psql -d aidb
alter user aiuser with password 'PASSWORD';
\q

Edit the Postgres configuration file pg_hba.conf located somewhere in /etc/postgresql and allow connections with password. There, replace the commands that enforce ident or md5 login. Note that Postgres looks only for the first line matching a connection type, thus don't insert several lines for the same connection type.

# All other connections by UNIX sockets
local all all password
# All IPv4 connections from localhost
host all all 127.0.0.1 255.255.255.255 ident password

Restart Postgres after configuration changes:

/etc/init.d/postgresql restart

Fill the accounting database with the accounting tables. The mix source tree contains the SQL file mixtables.sql with all instructions.

psql -U aiuser -d aidb < /home/mix/stable/mixtables.sql

Log in as aiuser with your password and check if you see the created tables or not... If you do, everything is OK!

psql -U aiuser -d aidb 
\dt
\q 
Personal tools