下载ejabberd
wget
执行下面命令安装ejabberd
gunzip ejabberd-2.1.2-linux-x86_64-installer.bin.gz
./ejabberd-2.1.2-linux-x86_64-installer.bin
按提示安装ejabberd
配置ejabberd支持mysql
填加mysql用户以及数据库
mysql:>create database ejabberd
mysql:>grant all privileges on ejabberd.* to ejabberd@’127.0.0.1′ IDENTIFIED BY ’ejabberd’;
mysql:>grant all privileges on ejabberd.* to IDENTIFIED BY ’ejabberd’;
建立ejabberd数据库中的表
mysql:>source /usr/local/ejabberd/lib/ejabberd-2.1.2/priv/odbc/mysql.sql;
更改/usr/local/ejabberd/conf/ejabberd.cfg文件
注释掉下面这行
{auth_method, internal}.
加入下面的两行
{auth_method, odbc}.
{odbc_server, {mysql, ”localhost”, ”ejabberd”, ”ejabberd”, ”ejabberd”}}.
把下面的注释去掉
{odbc_pool_size, 20}.
{odbc_keepalive_interval,30}.
如果不加入以上两行的话,MySQL中的连接池就会在sleep 时间超过wait_timeout的限制后被断开,导致ejabberd不能认证用户。查看
ejabberd.log会出现以下错误:
=ERROR REPORT==== 2010-03-02 10:44:09 ===
E(<0.426.0>:ejabberd_odbc:491) : mysql_conn: Received unknown signal, exiting : {mysql_recv,
<0.427.0>,
closed,
normal}
更改模块定义
MySQL:
- 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_vcard to mod_vcard_odbc to store user description in MySQL.