Linux平台的手动安装Tigase
参考:http://www.tigase.org/content/manual-installation-console-mode
1、Tigase是基于Java开发的,所以选先需要安装JDK
Tigase5.2.0需运行在JDK1.7版本以上(http://www.tigase.org/content/tigase-xmpp-server-520-final-release)
JDK下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html
解压到指定位置
$sudo cp jdk-7u60-linux-x64.tar.gz /usr/lib/jvm
$sudo tar -zvxf jdk-7u60-linux-x64.tar.gz
$sudo ln -s jdk1.7.0_60 java-7-sun
$sudo rm jdk-7u60-linux-x64.tar.gz
设置环境变量
$sudo vi /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-7-sun/bin
CLASSPATH="/usr/lib/jvm/java-7-sun/lib"
JAVA_HOME="/usr/lib/jvm/java-7-sun"
告诉系统,我们使用的sun的JDK
$sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-7-sun/bin/java 300
$sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-7-sun/bin/javac 300
$sudo update-alternatives --config java
此时屏幕会有如下显示:
0 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 自动模式
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 手动模式
* 2 /usr/lib/jvm/java-6-sun/bin/java 300 手动模式
3 /usr/lib/jvm/java-7-sun/bin/java 300 手动模式
要维持当前值[*]请按回车键,或者键入选择的编号:
由于我之前使用jdk1.6,所以当前选择为2,目录要使用jdk1.7,所以直接输入3回车
验证目前jdk使用版本
$java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed
JDK安装成功!
2、Tigase安装包下载
Tigase下载地址:https://projects.tigase.org/projects/tigase-server/files
先择你需要将载的版本,这里我下载最新版tigase-server-5.2.1-b3461-dist.tar.gz
3、Tigase安装包解压
将tigase-server-5.2.0-b3447-dist-max.tar.gz移动到你的安装目录,我这里使用/opt目录
sudo cp tigase-server-5.2.0-b3447-dist-max.tar.gz /opt/
cd /opt
sudo tar -zvxf tigase-server-5.2.0-b3447-dist-max.tar.gz
sudo chown wileywang:wileywang tigase-server-5.2.0-b3447 -R
sudo ln -s tigase-server-5.2.0-b3447 tigase
sudo rm tigase-server-5.2.0-b3447-dist-max.tar.gz
4、检查权限
检查./script/tigase.sh是否有可执行权限,如果没有则加上
$chmod u+x ./script/tigase.sh
5、修改修置文件./etc/tigase.conf
$vim./etc/tigase.conf,
将JAVA_HOME="${JDKPath}"修改成JAVA_HOME="${JAVA_HOME}"
6、修改初始化配置文件
a)修改域名
vim ./etc/init.properties
config-type=--gen-config-def
--admins=admin@$HOST_NAME
--virt-hosts = $HOST_NAME
--debug=server
将$HOST_NAME改你的域名,你可以用多个虚拟域名,具体见http://www.tigase.org/content/initproperties
b)增加数据库相关配置(这里我们使用mysql)
--user-db=mysql
--user-db-uri=jdbc:mysql://localhost:3306/tigasedb?user=tigase&password=tigase12&useUnicode=true&characterEncoding=UTF-8
7、初始化数据库
命令格式:./scripts/db-create-mysql.sh tigase_username tigase_password database_name root_username root_password database_host
执行$./scripts/db-create-mysql.sh tigase tigase12 tigasedb root 111111 localhost
执行结果
Loading schema
uid
1
NOW() - Setting schema version to 5.1
2014-07-04 14:07:20 - Setting schema version to 5.1
configuration:
--user-db=mysql
--user-db-uri=jdbc:mysql://localhost:3306/tigasedb?user=root&password=111111&useUnicode=true&characterEncoding=UTF-8&autoCreateUser=true
8.启动服务
./scripts/tigase.sh start etc/tigase.conf