Jabberd2

From CBLFS
Jump to: navigation, search
Download Source: http://codex.xiaoka.com/pub/jabberd2/releases/jabberd-2.2.10.tar.bz2

Contents

Introduction to Jabberd2

Jabberd2 is a next installment of XMPP Standards Foundation (formely Jabber oftware Foundation) reference XMPP daemon implementation.

Project Homepage: http://codex.xiaoka.com/wiki/jabberd2:start

Dependencies

Required

Optional

Non-Multilib

Please contribute

Multilib

32Bit

Please contribute

N32

Please contribute

64Bit

Compile the package:

CC="gcc ${BUILD64}" LD="ld ${LD_BUILD64}" \
./configure --prefix=/usr --sysconfdir=/etc/jabberd \
  --localstatedir=/var --libdir=/usr/lib64 \
  --enable-mysql

make

Install the package

make install

chmod -R 0640 /etc/jabberd/*

Configuring

This is a very basic configuration with this features:

  • MySQL for user authentification
  • plain text, no SSL
  • allows new users to create an account immediately

Create MySQL Database

mysql -u root -p < /usr/src/jabberd-2.2.10/tools/db-setup.mysql

Create Users and Further Configuration

  • Create User and Group for jabberd
groupadd jabber
useradd -g jabber jabber
  • Create folder /etc/jabberd and pass to root:jabber
chown -R root:jabber /etc/jabberd
  • Create folder for PIDs and pass to jabber:jabber
mkdir -p /var/run/jabberd/ &&
chown -R jabber:jabber /var/run/jabberd/
  • Configure PID-folder
  • /etc/jabberd/sm.xml
 Line 8:
 <pidfile>/var/run/jabberd/sm.pid</pidfile>
  • /etc/jabberd/c2s.xml
 Line 8:
 <pidfile>/var/run/jabberd/c2s.pid</pidfile>
  • /etc/jabberd/router.xml
 Line 8:
 <pidfile>/var/run/jabberd/router.pid</pidfile>
  • /etc/jabberd/s2s.xml
 Line 8:
 <pidfile>/var/run/jabberd/s2s.pid</pidfile>
  • Create folder for logfiles (must be configured for use, for the moment syslog is used)
mkdir -p /var/log/jabberd/ &&
chown -R jabber:jabber /var/log/jabberd
  • Create symlink to mysql.sock
ln -s /var/run/mysql/mysql.sock /tmp/mysql.sock
  • Create user and privileges in MySQL-DB
GRANT select,insert,delete,update ON jabberd2.* 
 to [DB-user]@localhost IDENTIFIED by '[Passwort]';
  • Configure for MySQL usage
  • /etc/jabberd/sm.xml
 Line 82:
 <storage>
   <path>/usr/lib64/jabberd</path>
   
   <driver>mysql</driver>
 
 Line 137p
 User und P/w
  • /etc/jabberd/c2s.xml
 Line 350:
 <module>mysql</module>
 
 Line 422:
 <user>jabberdbuser</user>
 <pass>jabberdbpass</pass>
  • Configure hostname and allow users to create an account
  • /etc/jabberd/sm.xml
 Line 1:
 <sm>
   <id>myserver.mysubdomain.mydomain</id>
 
 Line 67:
 <local>
   <id>myserver.mysubdomain.mydomain</id>
  • /etc/jabberd/c2s.xml
 Line 136:
 <id register-enable='true'>myserver.mysubdomain.mydomain</id>

Bootscript

  • Because of the nature of jabber's wrapper usual bootsrcipt functions cannot be used.
  • Jabber expects mysql.sock (or a link to it) in /tmp which is often cleaned during startup.
 #!/bin/sh
 #
 # File:       $rc_base/init.d/jabber
 # Purpose:    
 # Author:     Axel Bergerhoff
 # Created:    23.06.2010
 # Needs:      
 # Edited:   
 #
 #
 # ToDos:
 #
 # Changelog:  
 #  (1) ---
 #
 
 . /etc/sysconfig/rc
 . $rc_functions
 
 LINK2MYSQLSOCK="/tmp/mysql.sock"
 COMMAND="perl -w -x /usr/bin/jabberd"
 
 
 case "$1" in
   start)
     boot_mesg "Starting jabberd..."
 #   Test for existance of symlink to mysql.sock and create if necessary
     if [ ! -e "${LINK2MYSQLSOCK}" ]
     then
       ln -s /var/run/mysql/mysql.sock /tmp/mysql.sock
     fi
 
 #   Check if already running
     PIDLIST=`pidof perl`
     for process in $PIDLIST
     do
       FOUNDPROC=`ps -p ${process} -o command=`
       if [ "${FOUNDPROC}" == "${COMMAND}" ]
       then
         echo "${COMMAND} is already running with pid ${process}"
         exit 0
       fi
     done
 
 #   Start
     /usr/bin/jabberd &
 
 #   Check for successfull start
     PIDLIST=`pidof perl`
     for process in $PIDLIST
     do
       FOUNDPROC=`ps -p ${process} -o command=`
       if [ "${FOUNDPROC}" == "${COMMAND}" ]
       then
         echo_ok
       else
         echo_failure
       fi
     done
     ;;
 
   stop)
     boot_mesg "Stopping jabberd..."
 
     PIDLIST=`pidof perl`
     for process in $PIDLIST
     do
       FOUNDPROC=`ps -p ${process} -o command=`
       if [ "${FOUNDPROC}" == "${COMMAND}" ]
       then
         kill -15 ${process}
       fi
     done
     ;;
 
   restart)
 
     $0 stop
     sleep 5
     $0 start
     ;;
 
   status)
     ISRUNNING=0
     PIDLIST=`pidof perl`
     for process in $PIDLIST
     do
       FOUNDPROC=`ps -p ${process} -o command=`
       if [ "${FOUNDPROC}" == "${COMMAND}" ]
       then
         echo "${COMMAND} is running with pid ${process}"
         ISRUNNING=1
       fi
     done
     if [ ${ISRUNNING} -eq "0" ]
     then
         echo "${COMMAND} is not running"
     fi
     ;;
 
   *)
     echo "Usage: $0 {start|stop|restart|status}"
     exit 1
     ;;
 esac
 
 exit 0
 # End $rc_base/init.d/jabber

Link Bootscript in runlevels

ln -sv ../jabber /etc/init.d/rc3.d/S48jabber &&
ln -sv ../jabber /etc/init.d/rc4.d/S48jabber &&
ln -sv ../jabber /etc/init.d/rc5.d/S48jabber &&

ln -sv ../jabber /etc/init.d/rc0.d/K23jabber &&
ln -sv ../jabber /etc/init.d/rc1.d/K23jabber &&
ln -sv ../jabber /etc/init.d/rc2.d/K23jabber &&
ln -sv ../jabber /etc/init.d/rc6.d/K23jabber
Personal tools