Jumat, 08 Februari 2008

How to Install Jabberd2 useing Mysql authentication

Requreiment
1. Your favourite Distro (I use RedHat 9 Shrike)
2. Mysql(I use mysql-4.0.20.tar.gz)
3. libidn (I use libidn-0.5.9.tar.gz)
4. openssl (I use openssl-0.9.7g.tar.gz)
5. Jabberd2 (I use jabberd-2.0s8.tar.gz)

Reference
1. http://jabberd.jabberstudio.org/2/docs/jabberd_guide.html
2. http://linux.suramya.com/tutorials/JabberSetup/

Installation
1. Create jabber group and jabber user
# groupadd jabber
# useradd -g jabber jabber
2. Create PID and LOG directory
# mkdir -p /usr/local/var/jabberd/pid/
# chown -R jabber:jabber /usr/local/var/jabberd/pid/
# mkdir -p /usr/local/var/jabberd/log/
# chown -R jabber:jabber /usr/local/var/jabberd/log
3. openssl installation
# tar -zxvf openssl-0.9.7g.tar.gz
# cd openssl-0.9.7g
# ./config
# make
# make test
# make install
default directory will be on /usr/local/ssl
4. libidn installation
# tar -zxvf libidn-0.5.9.tar.gz
# cd libidn-0.5.9
# ./configure
# make
# make check
# make install
5. mysql installation
# groupadd mysql
# useradd -g mysql mysql
# tar -zxvf mysql-4.0.20.tar.gz
# cd mysql-4.0.20
# ./configure --prefix=/usr/local/mysql
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# bin/mysqld_safe --user=mysql &
6. Jabberd2 installation
# tar -zxvf jabberd-2.0s8.tar.gz
# cd jabberd-2.0s8
# ./configure --enable-mysql --enable-ssl --enable-idn \
--with-extra-include-path=/usr/local/mysql/include:/usr/local/mysql/include/mysql:
/usr/local/ssl/include:/usr/local/ssl/include/openssl --with-extra-library-path=
/usr/local/mysql/lib:/usr/local/mysql/lib/mysql:/usr/local/ssl/lib
# make
# make install
7. We have finished jabber installation, the default location will be on:
/usr/local/etc/jabberd -> file jabberd configuration
/usr/local/bin -> jabberd binary
8. 'Ownership' setting
# chown -R root:jabber /usr/local/etc/jabberd/*
'Permission' setting
# chmod -R 640 /usr/local/etc/jabberd/*
9. Create 'symlink' configuration file, so we can easy to edit those files:
ln -s /usr/local/etc/jabberd /etc/jabberd

Hostname Configuration
1. Open /usr/local/etc/jabberd/sm.xml file
2. Change 'hostname', example: veryeasytutorial.com

sm.xml file:

(!-- Session manager configuration -->

(!-- 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) -->
veryeasytutorial.com

3. Open /usr/local/etc/jabberd/c2s.xml file
4. Change 'hostname' (same like hostname at sm.xml file)

Pada file c2s.xml

(!-- Local network configuration -->

(!-- 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. -->
veryeasytutorial.com

Authentication with mysql
1. Change your current directory to '[source_jabber]/tools'
# cd /usr/local/src/jabberd-2.0s8/tools/
2. Run mysql
# mysql -u root -p
then run command below to import the database
mysql>\. db-setup.mysql
3. Create mysql user
# mysql -u root -p
mysql> GRANT select,insert,delete,update ON jabberd2.*
to jabberd2@localhost IDENTIFIED by 'mypassword';
Password mysql for jabberd2 is mypassword
4. edit file sm.xml file, the driver is mysql (default is mysql)

file sm.xml
(!-- Storage database configuration -->

(!-- By default, we use the MySQL driver for all storage -->
mysql

5. Edit user parameter and mysql password at sm.xml file

(!-- MySQL driver configuration -->

(!-- Database server host and port -->
localhost
3306

(!-- Database name -->
jabberd2

(!-- Database username and password -->
jabberd2
mypassword

(!-- Transaction support. If this is commented out, transactions
will be disabled. This might make database accesses faster,
but data may be lost if jabberd crashes.

This will need to be disabled if you are using a MySQL
earlier than v3.23.xx, as transaction support did not appear
until this version. -->



6. Authenticatin setting using mysql --> edit c2s.xml file

(!-- Authentication/registration database configuration -->

(!-- Backend module to use -->
mysql

7. User authentication parameterand mysql password --> edit c2s.xml file

(!-- MySQL module configuration -->

(!-- Database server host and port -->
localhost
3306

(!-- Database name -->
jabberd2

(!-- Database username and password -->
jabberd2
passwdrahasia


How to run jabberd2 daemon?
1. It's very easy, run these:
# su - jabber
$ cd /usr/local/bin
$ ./jabberd
2. Now u have your system running jabber daemon :)

Jcr and muc-conference for jabber conference
1. download jcr source
# http://jabber.terrapin.com/JCR/jcr-0.2.4.tar.gz
2. Uncompress jcr-0.2.4.tar.gz
# tar -zxvf jcr-0.2.4.tar.gz
3. Change directory to jcr-0.2.4
# cd jcr-0.2.4
4. Compile jcr
# make
5. mu-conference installation
6. Download source mu-conference
7. Save mu-conference-0.6.0.tar.gz on jcr directory
# cd jcr-0.2.4
8. Uncompress mu-conference-0.6.0.tar.gz
# tar zxvf mu-conference-0.6.0.tar.gz
9. Copy 'main.c' to src directory
# cp src/main.c mu-conference-0.6.0/src
10.Copy 'jcomp.mk' to src directory
# cp src/jcomp.mk mu-conference-0.6.0/src
11.Change prompt to mu-conference/src directory
# cd mu-conference-0.6.0/src
12.Compile mu-conference
# make -f jcomp.mk
13.Copy mu-conference executable file to/usr/local/bin
# cp mu-conference /usr/local/bin
14.Copy configuration file to jabber directory
# cp ../muc-jcr.xml /usr/local/etc/jabberd/
15.Now edit 'muc-jcr.xml' file
# cd /usr/local/etc/jabberd/
# vi muc-jcr.xml
16.Change'name' line and 'host' with 'conference.veryeasyturorial.com'
17.Add line: jabberd before 'secret' line
18.Change spool,logdir and pidlines directory:
/usr/local/var/jabberd/spool
/usr/local/var/jabberd/log
/usr/local/var/jabberd/pid
19.Create spool/conference.veryeasytutorial.com and it's owneship
# mkdir -p /usr/local/var/jabberd/spool/conference.nama.com
# chown -R jabber:jabber /usr/local/var/jabberd/spool
# mkdir /usr/local/var/jabberd/log
# mkdir /usr/local/var/jabberd/pid
20.Then, run jabberd server and mu-conference:
# su jabber
# /usr/local/bin/jabberd &
# /usr/local/bin/mu-conference -c /etc/jabberd/muc-jcr.xml &

---
I think it's not easy :P

Tidak ada komentar: