Configure ejabberd xmpp on ubuntu server part-2
configure ejabberd xmpp ubuntu server part 2
configure ejabberd xmpp ubuntu server part 1
In First Tutorial we have configure ejabberd XMPP with default menisa database . now in this tutorial i will explain how to configure ejabberd with MySql .
Step 1 : Open etc/ejabberd/ejabberd.cfg file and comment following line :
{auth_method, internal}.
and add the following line in file :
{auth_method, odbc}.
{odbc_server, {mysql, “server”, “database name”, “username”, “password”}}.
here
- server : your mysql server ip
- user name and password : database access username and password .
Step 2 :
Now you need to configure mysql on server . so for that you need to install SVN on Ubuntu server by following command :
sudo apt-get install subversion
after installation of SVN you need to download MySql module.
- first create a directory using mkdir command
- download following package http://svn.process-one.net/ejabberd-modules/mysql/trunk/ by using below command :
svn co http://svn.process-one.net/ejabberd-modules/mysql/trunk/
- after download run /.build.sh c file . it will generate following beam file in ebin folder
mysql.beam
mysql_auth.beam
mysql_conn.beam
mysql_recv.beam
- Please copy below file into ejabberd ebin directory /usr/lib/ejabberd/ebin this folder .
- now open etc/ejabberd/ejabberd.cfg file and do following changes
- Change mod_last to mod_last_odbc to store the last seen date in MySQL.
Change mod_offline to mod_offline_odbc to store offline messages in MySQL.
Change mod_roster to mod_roster_odbc to store contact lists in MySQL.
Change mod_private to mod_private_odbc to store user private XML storage in MySQL.
Change mod_privacy to mod_privacy_odbc to store user privacy lists in MySQL.
Change mod_pubsub to mod_pubsub_odbc to store PubSub nodes, items and subscriptions in MySQL.
Change mod_vcard to mod_vcard_odbc to store user description in MySQL.
Step 3 :
- Now Login in mySql Database and create a database “ejabberd“
- Now download ejabberd MySql table schema folloing command
wget https://raw.githubusercontent.com/processone/ejabberd/master/sql/mysql.sql
- Now import this file in recently created “ejabberd” database.
- For installing mod_archive (for saving chat in DB)
svn co https://svn.process-one.net/ejabberd-modules
cd ejabberd-modules/mod_archive/trunk
./build.sh (If this step gives an error install erlang-nox package)
copy ebin/* beam files in ejabberd ebin directory( /usr/lib/ejabberd/ebin)
- now go to this directory ejabberd-modules/mod_archive/trunk/src/ here you will find this “mod_archive_odbc_mysql.sql” my sql file , you need to import this file in recently created database “ejabberd“
- In /etc/ejabberd/ejabberd.cfg add mod_archive_odbc module
{mod_archive_odbc, [{database_type, "mysql"},
{default_auto_save, true},
{enforce_default_auto_save, true},
{default_expire, infinity},
{enforce_min_expire, 0},
{enforce_max_expire, infinity},
{replication_expire, 31536000},
{session_duration, 1800},
{wipeout_interval, 86400}]},sudo service ejabberd restart
Now you have configured Ejabberd with MySql
if you need any assistance please comment ..
Recent Comments