ejabberd mod_archive with MySQL on Ubuntu

  1. Install the MySQL ODBC driver,

    apt-get install libmyodbc

  2. 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       =
  3. Download mod_archive from Subversion.
  4. svn co https://svn.process-one.net/ejabberd-modules
    cd ejabberd-modules/mod_archive/trunk
  5. 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:
  6. trunk

    With

    branches/ejabberd-2.0.x

    And then run

    ./build.sh
  7. 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/.
  8. 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.
  9. Add in the configuration options to enable mod_archive in ejabberd.cfg, under modules:
  10. {mod_archive_odbc, []},
  11. Create ODBC connection:
  12. {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.

  13. 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}]}
    			]}
    
     ]}.
  14. The archives should then be visible at http://host:5280/archive/

More info

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks

10 thoughts on “ejabberd mod_archive with MySQL on Ubuntu

  1. g.

    you meant libmyodbc ?
    and other question, what is the location of odbc config file in which I should put [ejabberd] stuff?
    Besides, it’s one of the few tutorials of how to set up mod_archive in ejabberd. Found it by an accident ;-)

  2. lboynton Post author

    You are correct, g. I have updated the post to fix that typo and added the path to the ODBC config file. Hope you get it up and running OK!

  3. g.

    Yep, somehow I figured out what’s the right location and what’s the package name and got it running. Thanks for great tutorial. Btw. it’s also useful for debian lenny.

  4. Genilto

    you must insert all usernames in column us and auto_save = 1 in the table archive_global_prefs, anddd voila! The module will insert automatically in the archive_messages table.

  5. wildrock

    Hi,

    I can access to Archive viewer already but when I try to browse and Search … it ‘s return no match or empty…

    I check in the database ejabberd and archive_message tables, it ‘s empty also.

    Please give me any suggestion.

    Thanks

  6. Eunice

    when I browse to http://localhost:5280/archive/, I get “404 not found”. The log also displays the following error:

    “=ERROR REPORT==== 2012-10-23 14:42:53 ===
    Loading of /usr/lib/ejabberd/ebin/mod_archive_odbc.beam failed: badfile

    =ERROR REPORT==== 2012-10-23 14:42:53 ===
    C(:gen_mod:75) : Problem starting the module mod_archive_odbc for host “localhost”
    options: []
    error: undef

    =ERROR REPORT==== 2012-10-23 14:42:53 ===
    C(:gen_mod:80) : ejabberd initialization was aborted because a module start failed.”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>