|
| 1 | +# Openfire 安装和配置 |
| 2 | + |
| 3 | + |
| 4 | +## 本机环境 |
| 5 | + |
| 6 | +- 系统:CentOS 6.7 64 位 |
| 7 | +- JDK 1.8 64 位 |
| 8 | +- MySQL 5.6 |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +## Openfire 说明 |
| 13 | + |
| 14 | + |
| 15 | +- 官网:<http://www.igniterealtime.org/projects/openfire/> |
| 16 | +- 官网下载:<http://www.igniterealtime.org/downloads/index.jsp> |
| 17 | +- 官网插件列表:<http://www.igniterealtime.org/projects/openfire/plugins.jsp> |
| 18 | +- 官网文档:<http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/> |
| 19 | +- 官网安装手册:<http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/install-guide.html> |
| 20 | +- 官网安装手册-中文翻译版本:<http://wiki.jabbercn.org/Openfire:%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97> |
| 21 | +- 官网数据库部署手册:<http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/database.html> |
| 22 | +- javadoc 文档:<http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/javadoc/> |
| 23 | +- 连接管理工具(上千用户的时候用):<http://www.igniterealtime.org/projects/openfire/connection_manager.jsp > |
| 24 | + |
| 25 | + |
| 26 | +## 下载 |
| 27 | + |
| 28 | +- 官网下载:<http://www.igniterealtime.org/downloads/index.jsp> |
| 29 | +- 当前最新版本:**4.0.2**,下载文件:`openfire-4.0.2-1.i386.rpm` |
| 30 | + |
| 31 | + |
| 32 | +## 安装 MySQL、JDK |
| 33 | + |
| 34 | +- [MySQL 安装和配置](Mysql-Install-And-Settings.md) |
| 35 | +- [JDK 安装](JDK-Install.md) |
| 36 | + |
| 37 | + |
| 38 | +## 安装 Openfire |
| 39 | + |
| 40 | +- JDK 1.7 或以上,我这里使用 1.7 |
| 41 | +- CentOS 系列(Red Hat、Fedora)官网推荐安装 RPM 文件,因为有一些相关环境他们帮我们考虑了 |
| 42 | +- 安装命令:`rpm -ivh openfire-4.0.2-1.i386.rpm` |
| 43 | +- Openfire 默认给我们生成安装目录:**/opt/openfire** |
| 44 | +- 修改 JDK VM 参数:`vim /etc/sysconfig/openfire`,找到 23 行,打开 OPENFIRE_OPTS 删除这一行注释,分配多少 VM 你根据自己的机子来配置。 |
| 45 | +- 数据库的 my.cnf 文件建议采用我 MySQL 文章中推荐的 my.cnf。 |
| 46 | +- 初始化数据库: |
| 47 | + - 默认的初始化数据库脚本在(其他数据库类型的脚本也在这个目录下):**/opt/openfire/resources/database/openfire_mysql.sql** |
| 48 | + - 进入 MySQL 命令行状态:`mysql -u root -p` |
| 49 | + - 创建数据库:`create database `openfire` character set utf8;` |
| 50 | + - 退出 MySQL 命令行模式,在终端命令状态下,执行:`sudo mysql -u root -p openfire < /opt/openfire/resources/database/openfire_mysql.sql` |
| 51 | +- 先停掉防火墙:`service iptables stop` |
| 52 | +- 启动:`/etc/init.d/openfire start` |
| 53 | +- 查看进程:`ps aux | grep openfire` |
| 54 | +- 停止:`/etc/init.d/openfire stop` |
| 55 | +- 重启:`/etc/init.d/openfire restart` |
| 56 | +- 访问:`http://192.168.1.113:9090` |
| 57 | + |
| 58 | + |
| 59 | +- 数据库 URL 需要特别注意的是需要加入编码设置:jdbc:mysql://192.168.1.113:3306/openfire?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8 |
| 60 | +- 找到配置文件:conf/openfire.xml,连接mysql的地址改为: ?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8 |
| 61 | + |
| 62 | + |
| 63 | +如果连接不了数据库,可以看错误日志:`cat /opt/openfire/logs/error.log` |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +## 配置 |
| 69 | + |
| 70 | + |
0 commit comments