因为fab 要用到xmpp 所以有了下文
1.下载安装

1
2
3
wget -c  https://www.process-one.net/downloads/downloads-action.php?file=/ejabberd/15.07/ejabberd-15.07-linux-x86_64-installer.run
chmod +x ejabberd-15.07-linux-x86_64-installer.run
./ejabberd-15.07-linux-x86_64-installer.run

#下面是过程的重点 因为过程太多,不能全部在这里展示
ejabberd服务器域名 [vm2]: 192.168.1.109
集群
请从另一个节点复制 $HOME/.erlang.cookie 文件. 警告: 为安全起见, 您最好在防火墙中阻止外部连接4369端口.
按 [Enter] 继续:
2.启动 用启动脚本比较好

1
2
cp /opt/ejabberd-15.07/bin/ejabberd.init  /etc/init.d/ejabberd
/etc/init.d/iptables stop

WEB地址:http://ip地址:5280/admin
WEB地址:http://192.168.1.109:5280/admin
admin admin
3.mysql 配置
[[email protected] bin]# mysql -u root -p
Enter password:
创建用户和修改权限
mysql:>

1
2
3
create database ejabberd;
grant all privileges on ejabberd.* to [email protected]'127.0.0.1' IDENTIFIED BY 'ejabberd';
grant all privileges on ejabberd.* to [email protected]'localhost' IDENTIFIED BY 'ejabberd';

创建数据库,并导入 这里因为 全文导引的问题 mysql 5.6以上才行

1
mysql -uroot -proot ejabberd </opt/ejabberd-15.07/lib/ejabberd-15.07/priv/sql/mysql.sql;

4.
修改 /opt/ejabberd-15.07/conf/ejabberd.yaml 文件如下:
注释掉: auth_method: internal.
取消注释:auth_method: odbc.
取消注释并设置数据库名称和密码: (我的数据库帐号密码都是ejabberd)
odbc_type: mysql
odbc_server: “localhost”
odbc_database: “ejabberd”
odbc_username: “ejabberd”
odbc_password: “ejabberd”
5.新建帐号
#这样才是成功的
[[email protected] ejabberd-15.07]#

1
 /opt/ejabberd-15.07/bin/ejabberdctl register evan 192.168.1.109 123456

User [email protected] successfully registered
#这个是错误的
[[email protected] bin]# /opt/ejabberd-15.07/bin/ejabberdctl register evan localhost 123456
Failed RPC connection to the node [email protected]: nodedown
Commands to start an ejabberd node:
start Start an ejabberd node in server mode
debug Attach an interactive Erlang shell to a running ejabberd node
iexdebug Attach an interactive Elixir shell to a running ejabberd node
live Start an ejabberd node in live (interactive) mode
iexlive Start an ejabberd node in live (interactive) mode, within an Elixir shell
Optional parameters when starting an ejabberd node:
–config-dir dir Config ejabberd: /opt/ejabberd-15.07/conf
–config file Config ejabberd: /opt/ejabberd-15.07/conf/ejabberd.yml
–ctl-config file Config ejabberdctl: /opt/ejabberd-15.07/conf/ejabberdctl.cfg
–logs dir Directory for logs: /opt/ejabberd-15.07/logs
–spool dir Database spool dir: /opt/ejabberd-15.07/database/[email protected]
–node nodename ejabberd node name: [email protected]
http://docs.ejabberd.im/admin/guide/configuration/#database-and-ldap-configuration
中的Example of MySQL connection:
然后编辑ejabberd.yml文件
#我直接加了

1
2
3
4
5
6
7
acl:
  admin:
    user:
      - "evan": "localhost"
access:
  configure:
    admin: allow

#用户 evan 密码123456
#问题 后来这个的登录用户密码都不对了 原来是哪个注册用户没有成功
http://192.168.1.109:5280/admin
#安装文档
http://docs.ejabberd.im/admin/guide/installation/#installing-ejabberd-with-binary-installer