1 基础知识
1.1 压缩包命名规则
tigase-server-<version>-SNAPSHOT-b<build>-<type>
范例,
tigase-server-8.0.0-b10083-dist-max.zip
– “version”指代软件的版本
– “build”编译的编号
– “type”安装包的类型,包括以下类型,
— javadoc.jar,仅Javadoc安装程序
— dist.zip,不包含依赖关系的二进制压缩文件
— dist.tar.gz,不包含依赖关系的二进制tar压缩文件
— dist-max.zip,包含所有依赖关系的二进制压缩文件
— dist-max.tar.gz,包含所有依赖关系的二进制tar压缩文件
1.2 安装要求
– Open JDK17
– 使用具有管理员权限的用户安装Tigase Server(不要以root身份运行)
1.3 安装方法
– 使用Web Installer安装
– 使用控制台模式安装
– Windows环境中安装Tigase
– Tigase的网络设置
– Tigase XMPP服务器作为服务运行
2 最佳实践
2.1 系统环境
2.1.1 系统环境信息
OS = Oracle Linux 9.x x86_64
IP Address = 10.168.0.90
Host Name = tigase.cmdschool.org
另外,如果你对基本的系统配置不熟悉,可参阅如下文档,
2.1.2 安装JDK
由于Tigase基于使用Java技术,你需要先参阅如下文档安装openJDK
安装完成后,你可以使用如下命令确认安装
java -version
可见如下输出,
openjdk version "17.0.2" 2022-01-18 OpenJDK Runtime Environment (build 17.0.2+8-86) OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
2.1.3 配置名称解析
echo '10.168.0.90 tigase.cmdschool.org' >> /etc/hosts echo '10.168.0.90 cmdschool.org' >> /etc/hosts
注:
– 此操作代替DNS解析,如有DNS解析则无需设置
– 此域名解析应该配置当前服务器的hostname
2.2 安装前的准备
2.2.1 下载源代码
cd ~ wget https://github.com/tigase/tigase-server/releases/download/tigase-server-8.3.0/tigase-server-8.3.0-b12193-dist.tar.gz
另外,以上只是演示,如果不能下载,请使用浏览器从以下链接下载,
https://github.com/tigase/tigase-server/releases
2.2.2 解压软件包
tar -xf tigase-server-8.3.0-b12193-dist.tar.gz
2.2.3 预设防火墙端口
firewall-cmd --permanent --add-port 5222-5223/tcp firewall-cmd --permanent --add-port 5269/tcp firewall-cmd --permanent --add-port 5280/tcp firewall-cmd --permanent --add-port 5290/tcp firewall-cmd --permanent --add-port 8080/tcp firewall-cmd --reload firewall-cmd --list-all
2.3 部署tigase服务端
2.3.1 创建运行用户
groupadd -g 982 tigase useradd -u 982 -g 982 -d /usr/tigase -s /sbin/nologin tigase
2.3.2 部署软件包
mv tigase-server-8.3.0-b12193 /usr/ chown root:tigase -R tigase-server-8.3.0-b12193 chmod 775 -R /usr/tigase-server-8.3.0-b12193 rm -rf /usr/tigase ln -s /usr/tigase-server-8.3.0-b12193/ /usr/tigase
2.3.3 配置Tigase XMPP环境变量
echo 'export TIGASE_HOME="/usr/tigase"' > /etc/profile.d/tigase.sh source /etc/profile
2.3.4 修改启动配置文件
cp ${TIGASE_HOME}/etc/config.tdsl ${TIGASE_HOME}/etc/config.tdsl.default cp ${TIGASE_HOME}/etc/tigase.conf ${TIGASE_HOME}/etc/tigase.conf.default vim ${TIGASE_HOME}/etc/tigase.conf
配置修改如下,
osgiEnabled=false OSGI=${osgiEnabled} ENC="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8" JMX_REMOTE_IP="-Djava.rmi.server.hostname=0.0.0.0" JAVA_HOME="/usr/java/jdk-17.0.2" CLASSPATH="" JAVA_XSS=" -Xss228k " JAVA_DIRECT_MEMORY=" -XX:MaxDirectMemorySize=128m " JAVA_METASPACE=" -XX:MaxMetaspaceSize=160m " PRODUCTION_HEAP_SETTINGS=" -Xms8G -Xmx8G " JAVA_OPTIONS="${GC} ${GC_DEBUG} ${JVM_RESTART_ON_OOM} ${TLS_DEBUG} ${JVM_MEMORY} ${REMOTE_DEBUG} ${EX} ${ENC} ${FULL_STACKTRACES} ${JMX_REMOTE_IP} ${DISABLE_LOGGER_COLOR} -server ${PRODUCTION_HEAP_SETTINGS} ${JAVA_YOUNG_GEN_EXPLICIT_SIZE} ${JAVA_XSS} ${JAVA_DIRECT_MEMORY} ${JAVA_METASPACE} " TIGASE_HOME="/usr/tigase" TIGASE_CONSOLE_LOG="/var/log/tigase/tigase-console.log" TIGASE_CONFIG="/etc/tigase/tigase.xml" TIGASE_OPTIONS="" TIGASE_PID="/var/run/tigase/tigase.pid"
需要注意的是,Java家目录位置是“/usr/java/jdk-17.0.2”,然后我们需要根据配置创建以下需要使用的文件夹,
rm -rf /etc/tigase ln -s ${TIGASE_HOME}/etc/ /etc/tigase chown tigase:tigase -R ${TIGASE_HOME}/etc/ rm -rf /var/log/tigase ln -s ${TIGASE_HOME}/logs /var/log/tigase chown tigase:tigase -R ${TIGASE_HOME}/logs mkdir -p /var/run/tigase/ chown tigase:tigase /var/run/tigase/
然后,以下配置文件保留默认设置,
cat /etc/tigase/config.tdsl
可见如下配置,
'config-type' = 'setup' http () { setup () { 'admin-user' = 'admin' 'admin-password' = 'tigase' } } httpServer { connections { 8080 (active: false) {} 7080 () {} } }
2.4 手动测试服务
2.4.1 手动启动服务
runuser -u tigase /usr/tigase/scripts/tigase.sh status /etc/tigase/tigase.conf
然后,可以使用如下命令查看进程信息,
pgrep -u tigase -a java
命令显示如下,
1562 /usr/java/jdk-17.0.2/bin/java -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Djava.rmi.server.hostname=0.0.0.0 -server -Xms8G -Xmx8G -Xss228k -XX:MaxDirectMemorySize=128m -XX:MaxMetaspaceSize=160m -Dlogback.configurationFile=/usr/tigase/etc/logback.xml -cp /usr/tigase/jars/*: tigase.server.XMPPServer
然后,可以使用如下命令查看倾听的端口,
netstat -antp | grep `pgrep -u tigase java`
命令显示如下,
tcp6 0 0 :::7080 :::* LISTEN 6368/java
2.4.2 查询服务状态
runuser -u tigase /usr/tigase/scripts/tigase.sh status /etc/tigase/tigase.conf
2.4.3 停止服务
runuser -u tigase /usr/tigase/scripts/tigase.sh stop /etc/tigase/tigase.conf
2.5 部署启动脚本
2.5.1 创建启动脚本
cp ${TIGASE_HOME}/scripts/systemd/tigase-server /etc/default/tigase-server cp ${TIGASE_HOME}/scripts/systemd/tigase-server.service /usr/lib/systemd/system/tigase-server.service vim /usr/lib/systemd/system/tigase-server.service
配置修改如下,
[Unit] Description=Tigase XMPP Server After=syslog.target network-online.target [Service] Type=forking EnvironmentFile=/etc/default/tigase-server WorkingDirectory=/usr/tigase PIDFile=/var/run/tigase/tigase.pid ExecStartPre=/usr/bin/bash -c "mkdir -p /var/run/tigase; chown tigase:tigase /var/run/tigase" ExecStart=/usr/sbin/runuser -u tigase /usr/tigase/scripts/tigase.sh start /etc/tigase/tigase.conf ExecStop=/usr/sbin/runuser -u tigase /usr/tigase/scripts/tigase.sh stop /etc/tigase/tigase.conf StandardOutput=syslog StandardError=syslog Restart=on-failure RestartSec=10 KillMode=process [Install] WantedBy=multi-user.target
文件创建后,我们需要使用如下命令重载使服务生效,
systemctl daemon-reload
2.5.2 测试服务脚本
systemctl start tigase-server.service systemctl status tigase-server.service systemctl stop tigase-server.service
2.5.3 设置服务默认启动
systemctl enable tigase-server
2.6 初始化向导
2.6.1 配置名称解析
notepad \Windows\System32\drivers\etc\hosts
加入如下配置,
10.168.0.90 tigase.cmdschool.org
注:以上配置仅仅用于测试,生产环境请使用DNS代替
2.6.2 登录初始化页面
http://tigase.cmdschool.org:7080/
Admin: admin
Password: tigase
以上向导需要根据自己的需求配置,本章不再详述,如果你需要集成MongoDB,可参阅以下章节,
参阅文档
================
文档
————–
https://docs.tigase.net/en/latest/Tigase_Administration/Release_Notes/Tigase_Release_Notes.html#tigase-xmpp-server-8-3-0-change-notes
Tigase下载
—————
https://build.tigase.net/nightlies/dists/#/nightlies/dists/
https://tigase.net/xmpp-server
参阅文档
=================
Tigase下载
—————
https://build.tigase.net/nightlies/dists/#/nightlies/dists/
https://tigase.net/xmpp-server
Tigase安装指南
—————-
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#QuickStart
Tigase源代码
————
https://github.com/tigase/tigase-server/tree/tigase-server-8.0.0
DSL配置文件
———–
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#dslConfig
虚拟服务配置
———–
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#tigase41virtualHosts
JVM设置
————
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#jvm_settings
高负载Linux设置
————–
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#linuxhighload
日志配置
————-
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#customLogging
日志指南
———
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#logs
调试Tigase
———
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#debuggingTigase
离线消息
———
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#offlineMessages
服务器证书
———-
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#ServerCertificates
XMPP 支持的扩展
————-
https://docs.tigase.net/tigase-server/8.0.0/Administration_Guide/html/#features
问题的解决
———–
Unrecognized VM option ‘UseConcMarkSweepGC’
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
https://github.com/elastic/elasticsearch/issues/51361
https://stackoverflow.com/questions/65546614/unrecognized-vm-option-useconcmarksweepgc-when-running-sample-project
Unrecognized VM option ‘UseParNewGC’
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
https://stackoverflow.com/questions/49962437/unrecognized-vm-option-useparnewgc-error-could-not-create-the-java-virtual
Unrecognized VM option ‘CMSIncrementalMode’
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
https://askubuntu.com/questions/943284/jvm-errors-when-running-minecraft
Unrecognized VM option ‘ParallelCMSThreads=2’
Did you mean ‘ParallelGCThreads=’? Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
https://aijishu.com/a/1060000000094039
没有评论