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

Jabberd2安装

程承恩
2023-12-01
参考了好几份文档:

闲话就不提了。直接入正题:

1. 安装所需软件

在Fedora 6下我需要安装libidn,udns,gsasl,分别可以从这里下载:
http://ftp.gnu.org/gnu/libidn/libidn-1.9.tar.gz
http://www.corpit.ru/mjt/udns/udns_0.0.9.tar.gz
http://josefsson.org/gsasl/releases/gsasl-0.2.27.tar.gz

其中udns的编译环境做得不好,configure时不能设定prefix,也不提供make install,编译完后自己手动copy到目标环境中即可。另外,jabberd2也没有提供--with-udns之类的配置选项,但提供了--with-extra-library-path和--with-extra-include-path,需要时可以用一用。需要注意,--with-extra-include-path以及--with-extra-library-path假设你是用:分开不同的路径,使用时需要注意。下面是相应的configure.ac的代码:

  1. # extra paths
  2. AC_ARG_WITH([extra_include_path], AC_HELP_STRING([--with-extra-include-path],
  3.                                            [use additional include paths]),
  4.             extra_include_path=$withval)
  5. split_includes="`echo $extra_include_path | sed -e 's/:/ /g'`"
  6. for incpath in $split_includes ; do
  7.     CPPFLAGS="-I$incpath $CPPFLAGS"
  8. done
  9. AC_ARG_WITH([extra_library_path], AC_HELP_STRING([--with-extra-library-path],
  10.                                                [use additional library paths (remember to update /etc/ld.so.conf too)]),
  11.             extra_library_path=$withval)
  12. split_libs="`echo $extra_library_path | sed -e 's/:/ /g'`"
  13. for libpath in $split_libs ; do
  14.     LDFLAGS="-L$libpath $LDFLAGS"
  15. done


2. 编译配置,选择ldap和mysql支持。

./configure --prefix=/usr/local/jabberd2 --enable-ldap --enable-mysql --enable-ssl

3. 编译、安装
make
make install

4. 改动配置中所有的密码
这个很重要,第一步就把所有的密码都改了。
cd /usr/local/jabberd2/etc
grep secret *.xml

这样就可以很方便地把所有密码的位置全部找出来。一个个的改。

5. 设置jabber服务器运行用户,以及相应的目录
参考 http://jabberd2.xiaoka.com/wiki/InstallGuide/QuickStartGuide A.1.4, A.1.5
groupadd jabber
useradd -g jabber

export JABBER_HOME=/usr/local/jabberd2
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"

6. 设置MySQL数据库
参考: http://man.chinaunix.net/linux/debian/debian_learning/ch09s11.html

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' "

7. 设置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

8. 设置数据库访问用户名和密码

改动sm.xml和c2s.xml,找到mysql的配置项改掉就行了

9. 启动

./jabberd -b

10. 关闭

需要关闭router, resolver, c2s, s2s, sm这些程序



 类似资料: