ejabberd mod_archive with MySQL on Ubuntu
Follow these steps to enable mod_archive:
-
Install the MySQL ODBC driver,
apt-get install libmyodbc
-
Create an ODBC configuration for ejabberd at /etc/odbc.ini,
[ODBC Data Sources]
odbcname = MyODBC 3.51 Driver DSN
[ejabberd]
Driver = /usr/lib/odbc/libmyodbc.so
Description = MyODBC 3.51 Driver DSN
SERVER = localhost
PORT =
USER = ejabberd
Password = ejabberd
Database = ejabberd
OPTION = 3
SOCKET =
- Download mod_archive from Subversion.
svn co https://svn.process-one.net/ejabberd-modules cd ejabberd-modules/mod_archive/trunk
- You may then have to edit Emakefile before compiling. This is because by default it will point to the include files from ejabberd trunk, which will probably be for a newer version of ejabberd than you have installed, unless you installed ejabberd from trunk. in Emakefile replace all instances of:
trunk
With
branches/ejabberd-2.0.x
And then run
./build.sh
- This will generate some *.beam files in the ebin directory. Copy these to the ejabberd ebin directory which should contain all the other ejabberd .beam files. The directory for me is /usr/lib/ejabberd/ebin/.
- Create the MySQL database schema using the SQL scripts from mod_archive. They are in ejabberd-modules/mod_archive/trunk/src/*.sql. The script for MySQL is mod_archive_odbc_mysql.sql.
- Add in the configuration options to enable mod_archive in ejabberd.cfg, under modules:
-
{mod_archive_odbc, []}, - Create ODBC connection:
{odbc_server, "DSN=ejabberd;UID=ejabberd;PWD=ejabberd"}.
Note that the authentication won’t use this by default because in the configuration file there is an option:
{auth_method, internal}.
Which means it will use the internal mnesia database for auth.10. Finally, to view the archives in a web browser, add to the listen section of the ejabberd.cfg file:
{request_handlers, [{["archive"],mod_archive_webview}]}
So that the final section for port 5280 looks something like
{5280, ejabberd_http, [
http_poll,
web_admin,
{request_handlers, [{["archive"],mod_archive_webview}]}
]}
]}.
- The archives should then be visible at http://host:5280/archive/