搭建环境
- 操作系统:centos7
- 数据库:mysql
一、准备工作
- 下载软件:atlassian-confluence-6.7.1-x64.bin
wget https://downloads.atlassian.com/software/confluence/downloads/atlassian-confluence-6.7.1-x64.bin
- 下载工具:confluence-keygen 和 mysql driver
二、安装confluence
登陆centos7系统,并且执行安装脚本
cd /opt
# 下载软件
wget https://downloads.atlassian.com/software/confluence/downloads/atlassian-confluence-6.7.1-x64.bin
chmod +x atlassian-confluence-6.7.1-x64.bin
# 开始安装
/bin/sh atlassian-confluence-6.7.1-x64.bin
等待安装过程:默认安装,一路按
Enter
回车键即可安装完成,可访问:http://localhost:8090
三、破解confluence
备份原jar文件
cp /opt/atlassian/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.3.0.jar /opt/atlassian/atlassian-extras-2.4.jar
# 安装sftp图形化工具
yum install lrzsz
# 下载文件到本地环境,进行破解
sz /opt/atlassian/atlassian-extras-2.4.jar
2. **破解原jar文件**
> 运行破解工具`confluence-keygen.exe`,点击`patch`按钮,选择上一步从centos7下载的jar文件`atlassian-extras-2.4.jar`,进行破解
![](https://img2018.cnblogs.com/blog/1323383/201910/1323383-20191029183838915-113090545.png)
3. **破解文件替换原文件**
- 重命名破解文件`atlassian-extras-2.4.jar`为`atlassian-extras-decoder-v2-3.3.0.jar`
- 上传本地文件`atlassian-extras-decoder-v2-3.3.0.jar`和`mysql-connector-java-5.1.37.jar`到centos7服务器目录`/opt/atlassian/confluence/confluence/WEB-INF/lib/`(覆盖)
4. **重启confluence服务**
- 停止服务:`/bin/sh /opt/atlassian/confluence/bin/stop-confluence.sh`
- 启动服务:`/bin/sh /opt/atlassian/confluence/bin/start-confluence.sh`
<br/>
### 四、初始化confluence
1. **设置confluence**
![](https://img2018.cnblogs.com/blog/1323383/201910/1323383-20191029230941599-414098835.png)
2. **获取插件**
![](https://img2018.cnblogs.com/blog/1323383/201910/1323383-20191029231055087-910017269.png)
3. **获取授权码**
- 获取服务器ID
![](https://img2018.cnblogs.com/blog/1323383/201910/1323383-20191029231249108-884951758.png)
- 获取注册码
![](https://img2018.cnblogs.com/blog/1323383/201910/1323383-20191029231235573-1863294745.png)
4. **设置数据库**
- 建库脚本
```sql
# 数据库必须是utf8字符编码,排序规则必须是utf8_bin
create database confluence default character set utf8 collate utf8_bin;
grant all on confluence.* to 'confluence'@'%' identified by '123456';
flush privileges;
```
- 注意事项 : confluence事务隔离级别要求是READ-COMMITTED,否则安全会报错,有两种方式设置
1. `SET GLOBAL tx_isolation='READ-COMMITTED';` // 全局设置,不推荐
2. `jdbc:mysql://10.139.60.81:3306/confluence?sessionVariables=tx_isolation='READ-COMMITTED'` // 推荐通过连接方式设置
![](https://img2018.cnblogs.com/blog/1323383/201910/1323383-20191029231319706-1255324309.png)
5. **加载内容:我选择的就是第二种**
![](https://img2018.cnblogs.com/blog/1323383/201910/1323383-20191029231830818-663087378.png)
6. **设置成功 (中间省略步骤,按需填写)**
![](https://img2018.cnblogs.com/blog/1323383/201910/1323383-20191029232006684-255857311.png)