当前位置: 首页 > 工具软件 > Jabberd2s > 使用案例 >

jabberd2 安装配置

卢雅惠
2023-12-01

1、准备安装包:

    cyrus-sasl-2.1.23.tar.gz

    jabberd-2.2.11.tar.bz2

    libidn-1.19.tar.gz

    openssl-1.0.0a.tar.gz

    expat-2.0.1.tar.gz

    libgcrypt-1.4.6.tar.bz2

    mysql-5.0.91-linux-i686-glibc23.tar.gz(已装,忽略)

    udns_0.0.9.tar.gz

    zlib-1.2.5.tar.gz

    libgsasl-1.4.4.tar.gz

 

2、 设置jabber服务器运行用户,以及相应的目录

参考 http://jabberd2.xiaoka.com/wiki/InstallGuide/QuickStartGuide A.1.4, A.1.5
groupadd jabber
useradd -g jabber
export JABBER_HOME=/usr/local/easyjabberd
mkdir -p "$JABBER_HOME/var/jabberd/db"
mkdir -p "$JABBER_HOME/var/jabberd/log"
mkdir -p "$JABBER_HOME/var/jabberd/pid"
chown -R jabber:jabber "$JABBER_HOME/var/jabberd"

mkdir -p /usr/local/easyjabberd/app

 3、 安装expat,用作XML解析

   (1), tar zxvf expat-2.0.1.tar.gz

   (2), ./configure --prefix=/usr/local/easyjabberd/app/expat

   (3), make

   (4), make install

 

4、安装libidn

   (1), tar zxvf libidn-1.19.tar.gz

   (2), ./configure --prefix=/usr/local/easyjabberd/app/libidn

   (3), make

   (4), make install

 

5、安装udns

   udns的configure没有提供--prefix,所以我们编译后,手动拷贝所需要的文件到/usr/local/easyjabberd/app/目录下

   (3), ./configure

   (4), make

   (5), cp udns.h /usr/local/easyjabberd/app/include/

   (6), cp libudns.a /usr/local/easyjabberd/app/lib/

6、安装openssl

   (1), tar zxvf openssl-1.0.0a.tar.gz

   (2), cd openssl-1.0.0a

   (3), ./config --prefix=/usr/local/easyjabberd/app/

   (4), make

   (4), make install

 

7、 安装Cyrus sasl

   (1), tar zxvf cyrus-sasl-2.1.23.tar.gz

   (2), cd cyrus-sasl-2.1.23

   (3), ./configure --prefix=/usr/local/easyjabberd/app/ --with-openssl=/usr/local/easyjabberd/app/ CPPFLAGS="-I/usr/local/easyjabberd/app/include/ -I/usr/local/easyjabberd

/app/include/openssl" LDFLAGS="-L/usr/local/easyjabberd/app/lib"

   (4), make

   (5), make install

 

8、 安装zlib

    (1), tar zxvf zlib-1.2.5.tar.gz

    (2), cd zlib-1.2.5

    (3), ./configure --prefix=/usr/local/easyjabberd/app/

    (4), make

    (5), make install

 

9、  安装Jabberd2

   (1), tar jxvf jabberd-2.2.11.tar.bz2

   (2), cd jabberd-2.2.11

   (3), ./configure --prefix=/usr/local/easyjabberd/jabberd2 --enable-mysql=/usr/local/easyjabberd/mysql/ CFLAGS="-I/usr/local/easyjabberd/app/include -I/usr/local/easyjabberd/app/include/openssl" LDFLAGS="-L/usr/local/easyjabberd/app/lib -Wl,-R/usr/local/easyjabberd/app/lib" --with-extra-include-path=/usr/local/easyjabberd/app/include --with-extra-library-path=/usr/local/easyjabberd/app/lib  --with-sasl=cyrus --enable-mio=epoll

   (4), make

   (5), 调试报错,sx/sasl_cyrus.c 23行注释掉

   (6), make

   (7), make install


10、 设置MySQL数据库

参考:http://man.chinaunix.net/linux/debian/debian_learning/ch09s11.html
注:db-setup.mysql在解压包的 tool目录下
mysql --user=xxxx --password=xxxx < db-setup.mysql > output.log
mysql --user=xxxx --password=xxxx -e "grant select,insert,delete,update on jabberd2.* to jabberd2@localhost identified by '123456' "

11、 设置JID
参考:http://man.chinaunix.net/linux/debian/debian_learning/ch09s11.html

改动sm.xml,找到

<!-- Session manager configuration -->
<sm>
  <!-- Our ID on the network. Users will have this as the domain part of
       their JID. If you want your server to be accessible from other
       Jabber servers, this ID must be resolvable by DNS.s
       (default: localhost) -->
  <id>localhost</id>
把localhost改成你的服务器的真实服务器名,须要为FQDN

改动c2s.xml,找到

<!-- Local network configuration -->
  <local>
    <!-- Who we identify ourselves as. This should correspond to the
         ID (host) that the session manager thinks it is. You can
         specify more than one to support virtual hosts, as long as you
         have additional session manager instances on the network to
         handle those hosts. The realm attribute specifies the auth/reg
         or SASL authentication realm for the host. If the attribute is
         not specified, the realm will be selected by the SASL
         mechanism, or will be the same as the ID itself. Be aware that
         users are assigned to a realm, not a host, so two hosts in the
         same realm will have the same users.
         If no realm is specified, it will be set to be the same as the
         ID. -->
    <id>localhost</id>
把localhost改成你的服务器的真实服务器名,须要为FQDN

12、 设置数据库访问用户名和密码
改动sm.xml和c2s.xml,找到mysql的配置项改掉就行了

13、 启动
./jabberd -b 

如果想要输出调试信息,可以用下面的参数启动:

./jabberd -D

个人总结:mysql没有配置成功,于是手动改动配置文件里边的数据库选项。日志默认在systemlog里边,也需要手工改动,改成file格式。所有步骤都完成后,下载了个潘迪安测试(需要设置下下c2s的ip,port)。没有账号,开始注册。提示连接失败。查看c2s的日志,发现漏了第11步增加jid。修改完配置后,重新启动服务。可以注册成功了。


 类似资料: