linux tigase (IM服务器)安装

∥☆過路亽.° 提交于 2020-03-01 13:13:43

官方指导:http://www.tigase.org/content/manual-installation-console-mode

安装的为derby db,有人说是个内存数据库(也不是,数据会保留到磁盘)


1  下载安装包

https://projects.tigase.org/projects/tigase-server/files

从中选一个,tigase-server-5.2.0-b3447-dist-max.tar.gz

/**
Starting from version 5.2.0 there will be two separate archives:

minimal version (-dist) containing only tigase-server, tigase-xmltools and tigase-utils

max version (-dist-max) containing all additional tigase components (MUC, PubSub, HTTP API, OSGi support, etc.) as well as dependencies required by those components.*/


2  上传到linux服务器,解压

tar -zxvf tigase-server-5.2.0-b3447-dist-max.tar.gz

3  进入 tigase目录  

cd tigase-server-5.2.0-b3447-dist-max

4  赋予权限

chmod u+x ./scripts/tigase.sh

chmod u+x ./scripts/db-create-mysql.sh

5  设置JAVA_HOME

vi etc/tigase.conf

将 JAVA_HOME 设置下JAVA_HOME="${JAVA_HOME}"

因为5.2需要jdk1.7,环境默认是1.6所有增加了一步环境变量设置,

参考:http://www.tigase.org/content/startup-file-tigasesh-tigaseconf

因为其他脚本也可能需要用到,我独立放到了一个env.sh(当然你可以设置到tigase.conf)

export JAVA_HOME=/home/swr/install/jdk1.7.0_51 export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:/home/swr/install/tigase-5.2/jars
export PATH=${JAVA_HOME}/bin:$PATH
export TIGASE_HOME=/home/swr/install/tigase-5.2



为了方便启动和停服务,加了一个tg.sh

#!/bin/bash
source ./env.sh
./scripts/tigase.sh $1 etc/tigase.conf

被坑了一次,写成了tigase.config,结果启动不报错,但是改init.properties死活不生效

./scripts/tigase.sh $1 etc/tigase.config



./tg.sh start,起服务,tg.sh stop停服务


6  设置初始化配置文件

vi etc/init.properties

config-type=--gen-config-def

--admins=admin@tt.com

--virt-hosts =tt.com

--debug=server

--monitoring=jmx:9050,http:9080,snmp:9060

--user-db=mysql

--user-db-uri=jdbc:mysql://192.168.1.15:3306/tigasedb?user=tigase&password=tigase&useUnicode=true&characterEncoding=UTF-8

--comp-name-1 = muc

--comp-class-1 = tigase.muc.MUCComponent

--comp-name-2 = pubsub

--comp-class-2 = tigase.pubsub.PubSubComponent

如需要改端口,增加配置


--c2s-ports=5522,5523 
--s2s-ports=5622,5623


以上是例子,保存退出

7  初始化数据库

./scripts/db-create-mysql.sh database/mysql-installer-create-db.sql tigase tigase  tigasedb root_username root_password 192.168.1.15

参数说明:db-create-mysql.sh tigase_username tigase_password database_name root_username root_password database_host

这步需要mysql的root用户来创建mysql库,创建过程看下db-create-mysql.sh

创建的数据库表

8  启动tigase服务器

./scripts/tigase.sh start etc/tigase.conf

Starting Tigase: 
Tigase running pid=11179


9检查是否启动成

[root@s3-1 tigase-5.2]# ps -ef |grep tigase
root     11244 10748  0 16:30 pts/2    00:00:00 grep tigase

[root@s3-1 tigase-5.2]# cd logs/
[root@s3-1 logs]# ll
total 8
-rw-r--r-- 1 root root 1001 Mar  7 16:29 tigase-console.log
-rw-r--r-- 1 root root    6 Mar  7 16:29 tigase.pid

[root@s3-1 logs]# tail -200f tigase-console.log 
STARTED Tigase Fri Mar  7 16:29:23 CST 2014
Exception in thread "main" java.lang.UnsupportedClassVersionError: tigase/server/XMPPServer : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: tigase.server.XMPPServer.  Program will exit.

tigase 5.2需要jdk 7,替换后ok

10验证

安装Pandion(潘迪安)在360 上即可安装

安装完后进行注册用户如下图:



注册成功


自动登入如下图:

插入了表tigs_users

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!