PostgreSQL, like MySQL provides a very manageable backend for storage and authentication. Unlike MySQL, PostgreSQL provides better unicode support.
Complete this section if you are using PostgreSQL for storage and/or authorization. In order to set up PostgreSQL for Jabberd, you must create a database, create a PostgreSQL user and then run the PostgreSQL script included in the Jabberd 2 distribution.
Create the database for Jabberd. (The PostgreSQL server should already be running):
createdb -U postgres jabberd2
The command above will create a database from which you will be able to run the script for setting up the Jabberd PostgreSQL database.
createdb -U postgres -E UNICODE jabberd2
Now that your database is created, create a PostgreSQL user for the database.
createuser -P -U postgres jabberd2
This command will initiate an interactive user creation script. When prompted, enter the password that Jabberd will use to connect to your PostgreSQL database:
Enter password for user "jabberd2":
Enter it again:
Shall the new user be allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
The CREATE USER statement indicates that the command was successful.
After your jabberd user is created, you are ready to run the the PostgreSQL setup script. This script is located in '[Jabberd Source Files]/tools'. Switch to the tools directory and start the PostgreSQL console as the jabberd2 user:
psql -U jabberd2 jabberd2
Then, run the db-setup.pgsql script from the PostgreSQL console:
jabberd2=>\i db-setup.pgsql
PostgreSQL is now ready to be used with Jabberd 2.
sm.xml)
Complete this section if you are using PostgreSQL for storage. Most installations using PostgreSQL for storage will require only the setting of the driver, user and password.
In sm.xml under the section labeled Storage database configuration, edit the driver to use pgsql (PostgreSQL):
<!-- Storage database configuration -->
<storage>
<!-- By default, we use the MySQL driver for all storage -->
<driver>pgsql</driver>
sm.xml under the section labeled PostgreSQL driver configuration, replace secret with your PostgreSQL password. Change the user if you are not using the default user (jabberd2):
<!-- PostgreSQL driver configuration -->
<pgsql>
<!-- Database server host and port -->
<host>localhost</host>
<port>5432</port>
<!-- Database name -->
<dbname>jabberd2</dbname>
<!-- Database username and password -->
<user>jabberd2</user>
<pass>secret</pass>
<!-- Transaction support. If this is commented out, transactions
will be disabled. This might make database accesses faster,
but data may be lost if jabberd crashes. -->
<transactions/>
</pgsql>
Note that you should change the host setting only if your PostgreSQL server is running on a different host. You should change the port setting only if your PostgreSQL server is running on a non-standard port (port 5432 is the default for PostgreSQL installations). The transaction support section is self-explanatory.
Jabberd 2 is now configured to use PostgreSQL for storage.
If you wish to use an authentication package other than PostgreSQL, jump to your selection of authentication package:
Otherwise, continue on to 4.5.3. directly below to finish your Jabberd 2 configuration.
c2s.xml)
Complete this section if you are using PostgreSQL for authentication. Jabberd 2 authentication configuration for PostgreSQL is the same as above, except that the information is contained in c2s.xml.
In c2s.xml under the section labeled Authentication/registration database configuration, edit the module to use pgsql (PostgreSQL):
<!-- Authentication/registration database configuration -->
<authreg>
<!-- Backend module to use -->
<module>pgsql</module>
c2s.xml under the section labeled PostgreSQL module configuration, replace secret with your PostgreSQL password. Change the user if you are not using the default user (jabberd2):
<!-- PostgreSQL module configuration -->
<pgsql>
<!-- Database server host and port -->
<host>localhost</host>
<port>5432</port>
<!-- Database name -->
<dbname>jabberd2</dbname>
<!-- Database username and password -->
<user>jabberd2</user>
<pass>secret</pass>
</pgsql>
Note that you should change the host setting only if your PostgreSQL server is running on a different host. You should change the port setting only if your PostgreSQL server is running on a non-standard port (port 5432 is the default for PostgreSQL installations).
Your Jabberd 2 configuration for storage and authentication is now complete. Jump to Test Server to begin testing your server before moving on other configuration tasks, such as configuring SSL, in Section 5.
© 2003 Will Kamishlian and Robert Norris
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
