Table of Contents
Andrzej Wojcik <andrzejw@tigase.org> v2.0, June 2014: Reformatted for AsciiDoc. :toc: :numbered: :website: http://tigase.net :Date: 2012-06-16 09:38
This guide describes how to prepare the PostgreSQL database for connecting the Tigase server to it.
The PostgreSQL database can be prepared in many ways. Below are presented two of them. Following assumptions apply to both methods:
Run the PostgreSQL command line client and enter following instructions:
Add the tigase_user:
psql=# create role tigase_user with login password 'tigase123';
Create the database for the Tigase server with tigase_user as owner of database:
psql=# create database tigasedb owner tigase_user;
Load database schema to initialize the Tigase server from the file that corresponds to the Tigase version you want to use. First you need to switch to tigasedb.
psql=# \connect tigasedb
For the Tigase server version 5.0 and later you have to use proper schema version:
psql=# \i database/postgresql-schema-5.sql
For the Tigase server version 5.1 and later you have to use proper schema version:
psql=# \i database/postgresql-schema-5-1.sql
Follow steps below to prepare the PostgreSQL database:
Add the tigase_user:
createuser -U admin_db_user -W -D -R -S -P tigase_user
You will be asked for credentials for admin_db_user and password for new database user.
Create the database for the Tigase server with tigase_user as owner of database:
createdb -U admin_db_user -W -O tigase_user tigasedb
Load database schema to initialize the Tigase server from the file that corresponds to the Tigase version you want to use. For the Tigase server version 5.0 and later you have to use proper schema version:
psql -q -U tigase_user -W tigasedb -f database/postgresql-schema-5.sql
For the Tigase server version 5.1 and later you have to use proper schema version:
psql -q -U tigase_user -W tigasedb -f database/postgresql-schema-5-1.sql
Above commands should be executed from the main Tigase directory. The initialization schema file should be also available locally in database/ directory of your Tigase installation.