centos 7.9搭建安装confluence-7

centos 7.9搭建安装confluence-7

1、安装Java环境

1.1 解压tar包

[root@wiki ~]# tar xf jdk-8u171-linux-x64.tar.gz -C /usr/local/
[root@wiki ~]# mv /usr/local/jdk1.8.0_171 /usr/local/jdk

1.2 配置java环境变量

# 配置java环境变量
[root@wiki ~]# sed -i.ori '$a export JAVA_HOME=/usr/local/jdk\nexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH\nexport CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar' /etc/profile

[root@wiki ~]# tail -3 /etc/profile
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

# 使环境变量立刻生效
[root@wiki ~]# source /etc/profile

1.3 检查java是否安装成功

#检查java是否安装成功
[root@wiki ~]# java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

2、安装Confluence

官方链接:Confluence Server 下载存档 | Atlassian

2.1 创建安装目录

# 下载Confluence包
[root@wiki ~]# wget https://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-7.19.7.tar.gz

# 创建安装目录
[root@wiki ~]# mkdir -p /data/wiki/confluence

# 解压缩
[root@wiki ~]# tar xf atlassian-confluence-7.19.7.tar.gz -C /data/wiki/confluence/
 
[root@wiki ~]# cd /data/wiki/confluence/
[root@wiki confluence]# ll
总用量 0
drwxr-xr-x 12 1000 1000 314 3月  21 14:02 atlassian-confluence-7.19.7

2.2 配置数据目录

[root@wiki confluence]# vim atlassian-confluence-7.19.7/confluence/WEB-INF/classes/confluence-init.properties

[root@wiki confluence]# tail -1 atlassian-confluence-7.19.7/confluence/WEB-INF/classes/confluence-init.properties 
confluence.home=/data/wiki/confluence

2.3 启动confluence

# 启动confluence
[root@wiki confluence]# cd atlassian-confluence-7.19.7/bin/
[root@wiki bin]# ./start-confluence.sh 

To run Confluence in the foreground, start the server with start-confluence.sh -fg
executing as current user
If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide

Server startup logs are located in /data/wiki/confluence/atlassian-confluence-7.19.7/logs/catalina.out
---------------------------------------------------------------------------
Using Java: /usr/local/jdk/bin/java
2023-04-07 15:03:38,779 INFO [main] [atlassian.confluence.bootstrap.SynchronyProxyWatchdog] A Context element for ${confluence.context.path}/synchrony-proxy is found in /data/wiki/confluence/atlassian-confluence-7.19.7/conf/server.xml. No further action is required
---------------------------------------------------------------------------
Using CATALINA_BASE:   /data/wiki/confluence/atlassian-confluence-7.19.7
Using CATALINA_HOME:   /data/wiki/confluence/atlassian-confluence-7.19.7
Using CATALINA_TMPDIR: /data/wiki/confluence/atlassian-confluence-7.19.7/temp
Using JRE_HOME:        /usr/local/jdk
Using CLASSPATH:       /data/wiki/confluence/atlassian-confluence-7.19.7/bin/bootstrap.jar:/data/wiki/confluence/atlassian-confluence-7.19.7/bin/tomcat-juli.jar
Using CATALINA_OPTS:   -Datlassian.plugins.startup.options='' -Dorg.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE=32768 -Dconfluence.context.path= -Djava.locale.providers=JRE,SPI,CLDR -Dsynchrony.enable.xhr.fallback=true -Datlassian.plugins.enable.wait=300 -Djava.awt.headless=true -Xloggc:/data/wiki/confluence/atlassian-confluence-7.19.7/logs/gc-2023-04-07_15-03-38.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M -Xlog:gc+age=debug:file=/data/wiki/confluence/atlassian-confluence-7.19.7/logs/gc-2023-04-07_15-03-38.log::filecount=5,filesize=2M -XX:G1ReservePercent=20 -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDateStamps -XX:+IgnoreUnrecognizedVMOptions -XX:ReservedCodeCacheSize=256m -Xms1024m -Xmx1024m 
Using CATALINA_PID:    /data/wiki/confluence/atlassian-confluence-7.19.7/work/catalina.pid
Tomcat started.
# 检查端口是否成功启动
[root@wiki bin]# netstat -nltp | grep 8090
tcp6       0      0 :::8090                 :::*                    LISTEN      8783/java     

[root@wiki bin]# lsof -i:8090
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    8783 root   56u  IPv6  30231      0t0  TCP *:8090 (LISTEN)

3、安装MySQL

下载地址:MySQL :: Download MySQL Community Server

3.1 下载MySQL包

# 卸载系统自带mariadb-libs
[root@wiki ~]# yum -y remove mysql-libs

# 安装依赖包
[root@wiki ~]# yum -y install net-tools libaio

# 下载MySQL包
[root@wiki ~]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar

3.2 解压、安装mysql

# 解压
[root@wiki ~]# tar xf mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar

# 批量安装rpm包
[root@wiki ~]# yum -y install *

3.3 初始化数据库

[root@wiki ~]# mysqld --initialize --user=mysql
[root@wiki ~]# mysqld --initialize-insecure --user=mysql

4、启动mysql

# 启动mysql
[root@wiki ~]# systemctl start mysqld

# 查看mysql状态
[root@wiki ~]# systemctl status mysqld | grep active
   Active: active (running) since 五 2023-04-07 15:24:36 CST; 19s ago

# 查看mysql端口是否成功启动
[root@wiki ~]# netstat -nltp | grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      9127/mysqld         
tcp6       0      0 :::33060                :::*                    LISTEN      9127/mysqld  

# 查看mysql版本
[root@wiki ~]# mysql --version
mysql  Ver 8.0.28 for Linux on x86_64 (MySQL Community Server - GPL)

5、安装驱动

驱动下载:Download mysql JAR files with all dependencies

我这里mysql是8.0.28版本,所以驱动也是选的8.0.28

5.1 下载驱动

下载之后解压把jar包移入/data/wiki/confluence/atlassian-confluence-7.19.7/confluence/WEB-INF/lib目录下

[root@wiki ~]# mv mysql-connector-java-8.0.28.jar /data/wiki/confluence/atlassian-confluence-7.19.7/confluence/WEB-INF/lib/

5.2 修改mysql配置

[root@wiki ~]# vim /etc/my.cnf
[root@wiki ~]# egrep -v "^#|^$" /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

init-connect ='SET NAMES utf8'
bind-address = 127.0.0.1
port = 3306
innodb_file_per_table=1
 
#confluence
character-set-server=utf8mb4
collation-server=utf8mb4_bin
default-storage-engine=INNODB
max_allowed_packet=256M
innodb_log_file_size=2GB
transaction-isolation=READ-COMMITTED
binlog_format=row

[client]
port = 3306
socket = /var/lib/mysql/mysql.sock
default-character-set = utf8mb4

5.3 重启mysql

[root@wiki ~]# systemctl restart mysqld

5.4 修改密码

# 查看临时密码
[root@wiki ~]# cat /var/log/mysqld.log|grep localhost
2023-04-07T07:58:04.962926Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: )M(M+ClSU7LT
# 修改密码
[root@wiki ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.01 sec)

mysql> 

5.5 创建confluence数据库、创建对应账户并授权

mysql> CREATE DATABASE confluence CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
Query OK, 1 row affected (0.00 sec)

mysql> create user 'confluenceuser'@'localhost' IDENTIFIED BY 'xxx';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all privileges on confluence.* TO 'confluenceuser'@'localhost' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

6、配置web

6.1 打开web页面 ,进入系统安装页面。

6.2 选择语言:中文

image.png-85kB

6.3 记录服务器ID

image.png-32.7kB

6.4 下载破解程序并上传

# 下载破解程序
[root@wiki ~]# wget https://github.com/haxqer/confluence/releases/download/v1.3.3/atlassian-agent.jar
 
# 把agent加入到Java中
[root@wiki ~]# echo 'export JAVA_OPTS="-javaagent:/root/atlassian-agent.jar ${JAVA_OPTS}"' >> /root/.bashrc 

# 需要重启confluence
[root@wiki ~]# cd /data/wiki/confluence/atlassian-confluence-7.19.7/bin/

[root@wiki bin]# ./stop-confluence.sh 
[root@wiki bin]# ./start-confluence.sh

#检查是否有agent参数
[root@wiki ~]# ps aux|grep java |grep agent
root       9957  167 22.4 4385956 866876 pts/2  Sl   16:29   0:10 /usr/local/jdk/bin/java -Djava.util.logging.config.file=/data/wiki/confluence/atlassian-confluence-7.19.7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -javaagent:/root/atlassian-agent.jar .....
# 服务器ID 
# 执行破解,获得授权码
[root@wiki ~]# java -jar atlassian-agent.jar -p conf -m zzz@bbb.com -n zhile -o https://zhile.io -s BY4Q-R4C1-E3PP-7U4C

====================================================
=======     Atlassian Crack Agent v1.3.1     =======
=======           https://zhile.io           =======
=======          QQ Group: 30347511          =======
====================================================

Your license code(Don't copy this line!!!): 

AAABgA0ODAoPeJxtUd1yojAYvc9TMLOXHZSAgutMZtYGdN0VtbV0dy9D/JSMEJgkauHpi0hvtr3MOZPz932bK2HNKmU5gYX9qedMx9iiuxfLdVwPUQXMiFKGzAC5IbYzsp0ARReWnzuGHFiuAYWguRJVhyQyF4UwsLdywUFqsNLayoyp9HQ4bDKRw0CUaKOOTAp9F/nE8lIeBowbcQFi1BkQLaVp31HMRE6apvmRpumAlwXqPX4ynZGYXul8Pvx1DIu368zNm3113YvH+IQXY5z8TmbZk1nsa+91GOZpRE/8T82r+m/0sKALeSTkbrszTBlQfbMOWt1NXuoK1qwAQjdxHD3T5WyF2kDSgGSSQ/RWCVX3W02+t0Pdtur/LkOyWoa7aG2vsD9xJmPfHWMc+GgH6gKqpR//jZ7s5xHFduRtt3aQjCg6Qf0KSt82wr7jBM7E8/CH5Nd+27PiGdPw/836oT7k3Huz9blIQW0OiW5xYmPUJiRfpOz379p3V3oHIIe4XjAtAhUAg3WSxP8sqjOVUXaNtUw7ttWN4zQCFA4LJWko8V5bM5M9uMFudFYZT3DoX02im

6.5 生成激活码输入然后下一步

image.png-77.3kB

6.6 选择自己的数据库

image.png-72.7kB

6.7 输入相关数据库信息

image.png-72.5kB

image.png-89.9kB

6.8 设置管理员账户信息(ywb97!!08)

image.png-84.5kB

image.png-43.8kB

image.png-21.5kB

这样就可以愉悦的玩耍了,其他功能请自行探索
image.png-87.1kB