linux 安装jabberd2服务器全过程

一、安装
1、下载需要的工具,并将所有的文件解包
mysql-advanced-5.6.23-linux-glibc2.5-x86_64.tar.gz
(最好使用官方提供的编译好的二进制包,文件名含有glibc的)
expat-2.1.0.tar.gz
libidn-1.30.tar.gz
udns-0.4.tar.gz
openssl-1.0.2a.tar.gz
cyrus-sasl-2.1.26.tar.gz
zlib-1.2.8.tar.gz
libgsasl-1.8.0.tar.gz
jabberd-2.3.2.tar.gz


ls *.tar.gz | xargs -n1 tar xf


2、安装mysql数据库
复制解压后的mysql目录到软件安装目录
添加系统mysql组和mysql用户:
执行命令:groupadd mysql和useradd -r -g mysql mysql
进入安装mysql软件目录
修改mysql目录拥有者为mysql用户:执行命令 chown -R mysql:mysql ./
安装数据库:执行命令 ./scripts/mysql_install_db --user=mysql
修改当前目录拥有者为root用户:执行命令 chown -R root:root ./
修改当前data目录拥有者为mysql用户:执行命令 chown -R mysql:mysql data
到此数据库安装完毕


将bin目录添加到系统的PATH变量中:export PATH=$PATH:${HOME}/usr/mysql/bin


修改my.cnf文件,指定运行身份为mysql以及log、pid、sock文件的路径。


运行mysqld_safe文件运行mysql服务器端,可用ps -aux | grep mysql | grep -v "grep"命令查看是否运行。也可以在运行时指定服务器的参数:sudo ./mysqld_safe --basedir=/home/shibo/usr/local/mysql_5.6.23 --datadir=/home/shibo/usr/local/mysql_5.6.23/data --user=mysql


可能的错误:[ERROR] Native table ‘performance_schema’
解决方法:sudo bin/mysql_upgrade -u root -p


运行mysql启动数据库客户端。


执行下面命令,指定管理员账号的密码:
grant select,insert,delete,update on * to 'root'@'%' identified by '123456';
grant select,insert,delete,update on * to 'root'@'localhost' identified by '123456';


该命令运行任何客户端连接该服务器。


关闭mysql服务器的方法:mysqladmin -u root -p shutdown


3、安装expat
cd expat-2.1.0/
mkdir debug
cd debug
../configure --prefix=/opt/wacos/server/xmpp/app
make
make install


cd ../..


4、安装libidn
cd libidn-1.30/
mkdir debug
cd debug
../configure --prefix=/opt/wacos/server/xmpp/app
make
make install


cd ../..


5、安装udns
cd udns-0.4/
../configure
make
cp udns.h /opt/wacos/server/xmpp/app/include
cp libudns.a /opt/wacos/server/xmpp/app/lib


cd ../


6、安装openssl
cd openssl-1.0.2a/
./config -fPIC --prefix=/opt/wacos/server/xmpp/app no-gost no-shared no-zlib
make depend
make install


cd ../


7、安装cyrus
cd cyrus-sasl-2.1.26/
mkdir debug
cd debug
这里需要先做一下修改
vim ../plugins/digestmd5.c
62行#ifdef WITH_SSL_DES 注释掉
还有80行与之对应的#endid


vim ../saslauthd/auth_getpwent.c
57行:把#   include 改成#   include
然后在配置、安装
../configure --prefix=/opt/wacos/server/xmpp/app --with-openssl=/opt/wacos/server/xmpp/app CPPFLAGS="-I/opt/wacos/server/xmpp/app/include" LDFLAGS="-L/opt/wacos/server/xmpp/app/lib"


cd ../


8、安装zlib
cd zlib-1.2.8/
./configure --prefix=/opt/wacos/server/xmpp/app
make
make install


cd ../


9、安装libgsasl
cd libgsasl-1.8.0
mkdir debug
cd debug
../configure --prefix=/opt/wacos/server/xmpp/app
make
make install


cd ../../


10、安装jabberd
cd jabberd-2.3.2/
./configure --prefix=/opt/wacos/server/xmpp/jabberd2 \
--enable-debug --enable-pgsql --enable-ssl --enable-mio=epoll --enable-mysql=/usr/bin/ \
CFLAGS="-DDEBUG -I/opt/wacos/server/xmpp/app/include -I/opt/wacos/server/xmpp/app/include/openssl -I/opt/wacos/server/xmpp/app/include/sasl" \
LDFLAGS="-L/opt/wacos/server/xmpp/app/lib -Wl,-R/opt/wacos/server/xmpp/app/lib" \
--with-extra-include-path=/opt/wacos/server/xmpp/app/include:/usr/local/include/mysql \
--with-extra-library-path=/opt/wacos/server/xmpp/app/lib:/usr/local/lib/mysql
make
make install


二、配置
1、在mysql数据库中导入jabberd用到的数据库
在jabberd安装包中找到db-setup.mysql文件的位置
运行mysql客户端
执行:\. db-setup.mysql


2、设置jabberd数据库的管理员账号
grant select,insert,delete,update on jabberd2.* to 'jabberd2'@'%' identified by '123456';
grant select,insert,delete,update on jabberd2.* to 'jabberd2'@'localhost' identified by '123456';


这样就设置了jabberd的用户名:jabberd2,密码:123456


3、修改jabberd安装目录中etc目录下的sm.xml、c2s.xml、s2s.xml、router.xml文件
修改c2s.xml中的sqlitemysql
       sm.xml中的sqlitemysql


修改数据库连接密码:

    jabberd2
    123456



4、设置mysql动态库的变量
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/shibo/usr/local/mysql_5.6.23/lib


5、运行jabberd2
./jabberd2 -D

你可能感兴趣的:(XMPP)