Use confluence to build your own knowledge base

Preface

Although there are many knowledge base websites based on cloud services on the Internet, you can upload and manage your own blog posts. However, considering privacy, you need to create one in your own local environment. Since I have been using Confluence for work, it is very convenient, so I chose to use it. to build your own knowledge base.

Preparation

  1. Docker client

    If you are a Windows user, it is strongly recommended to enable WSL2 (system version above win10), which will greatly improve performance.
    How to install WSL2
    WSL1 How to upgrade to WSL2

  2. Mysql

  3. Confluence

Specific steps

  1. Run to create mysql mirror, other versions
docker run -p 3306:3306 --name "mysql" -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7

The MYSQL_ROOT_PASSWORD parameter must be added, otherwise it will fail to start because there is no password.

  1. The prerequisite work is to modify the mysql configuration file (solve the problem of Chinese garbled characters in confluence) . Enter apt-get update
    on the command line page to ensure that vim/vi can be installed.

    Installation command: apt-get install vim -y

# 访问修改配置文件, 若找不到可以使用 whereis mysql 
root@7faaa829002a:/# vim /etc/mysql/mysql.conf.d/mysqld.cnf

Add the following configuration, otherwise it will be impossible to create a database that meets the confluence standard.

collation_server=utf8_unicode_ci
character_set_server=utf8
# 此处是忽略客户端的字符集,使用服务器的设置, 否则会出现客户端连接字符集不对最终的导致存储乱码
skip-character-set-client-handshake
# 设置事务隔离级别
transaction-isolation=READ-COMMITTED
# 设定 innodb 日志文件大小
innodb_log_file_size = 268435456
# 设定服务器端和客户端在一次传送数据包的过程当中最大允许的数据包大小
max_allowed_packet=35651584

Insert image description here

You can also use the docker cp command to paste it into a local file. Remember to modify the permissions of the configuration file to 655 after cp. Otherwise, the configuration will not take effect. For the specific cause of the accident, please refer to the solution for the configuration not taking effect after the Mysql configuration file is modified .

Restart the mysql service

docker restart mysql

Use Navicat software to access the corresponding mysql service. The account root and password are set above. Create a database name confluence . The character set needs to be UTF-8.

# 创建库,字符集以及排序规则
CREATE DATABASE confluence DEFAULT CHARACTER SET = 'utf8' COLLATE  = 'utf8_bin'; 
  1. Run to create confluence mirror, other versions
docker run -d --name confluence -p 8090:8090 --link mysql:db --user root:root atlassian/confluence:6.13.0

# 建议下载使用这个,因为 confluence 官方库需要搭配 mysql5.1的版本,否则需要额外安装驱动程序,下方的免去上述问题,并且中文汉化。
docker run -d --name confluence -p 8090:8090 --link mysql:db --user root:root cptactionhank/atlassian-confluence	

  1. Visit 127.0.0.1:8090 to start configuring confluence.

  2. Select product installation
    Insert image description here

  3. Record the server ID, which is the server ID (used for cracking)
    ![Insert image description here](https://img-blog.csdnimg.cn/24b59df305344811a526e4ad0bebc21e.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5aW56K-05LuW5piv5Liq5pyo5YG2 ,size_20,color_FFFFFF,t_70,g_se ,x_1

  4. Enter the following command in the corresponding container of confluence to extract the corresponding files

C:\Users\他说他是个木偶>docker exec -it confluence bash
# 查找相关配置文件,效果图如下所示
/var/atlassian/confluence # find /opt/ -name '*atlassian-extras-decoder*'
# windows 系统使用管理员运行 cmd 将对应文件 cp 到电脑上.
docker cp confluence:/opt/atlassian/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.4.1.jar c:\

Insert image description here
Record the file name and modify the file name to atlassian-extras-2.4.jar to solve subsequent cracking and addressing problems.

  1. Download crack program
    link: Link: https://pan.baidu.com/s/1OEefpNTpCDE20HrZR-aUmA
    Extraction code: 8888

    Run confluence_keygen.jar, enter the Name and recorded Server ID, click gen
    Insert image description here
    and click patch to find the file copied at that time, then copy the corresponding Key , restore the file to its original name, and copy it to the docker container.

docker cp c:\atlassian-extras-decoder-v2-3.4.1.jar confluence:/opt/atlassian/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.4.1.jar
  1. Restart the confluence service
docker restart confluence
  1. Click next as shown in the picture
    Insert image description here

  2. 设置 mysql 配置
    DATA TYPE: MYSQL
    setup type:by connect string
    DATA URL : jdbc:mysql://db/confluence?useSSL=false
    Insert image description here

  3. Click "Demonstration Site" to familiarize beginners with related functions

1NETiBA5aW56K-05LuW5piv5Liq5pyo5YG2,size_20,color_FFFFFF,t_70,g_se,x_16)

  1. Enter the system administrator account
    Insert image description here

  2. Then you can use it. If there is a system freeze, it is mostly a memory problem, because the memory allocated by default is 1g. At this time, you can modify the corresponding parameters.

vi /opt/atlassian/confluence/bin/setenv.sh

Change the 1024m in CATALINA_OPTS="-Xms1024m -Xmx1024m -XX:+UseG1GC ${CATALINA_OPTS}" to the memory size you allow.
I allocated 10g of memory to him here, as shown in the figure below
Insert image description here
. After restarting the corresponding service, you can see the corresponding JVM memory statistics in Settings-System Information.
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_43832080/article/details/123693192