搭建confluence(企业博客)
1、需要的安装包
https://www.atlassian.com/software/confluence/download-archives
atlassian-confluence-7.13.3-x64.bin
atlassian-extras-3.2.jar
Confluence-5.6.6-language-pack-zh_CN.jar
mysql-connector-java-5.1.39-bin.jar
wordpress-4.7.2-zh_CN.tar.gz
wordpress-4.9.4-zh_CN.zip
2、部署环境
#java环境 #我们选择将java变量设置在.bash_profile,使其永久生效 [root@ftp-sharedata-server wiki_install]# vim /root/.bash_profile JAVA_HOME=/wiki/jdk-17.0.1/ JRE_HOME=$JAVA_HOME/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH [root@ftp-sharedata-server wiki_install]# source /root/.bash_profile [root@ftp-sharedata-server wiki_install]# java -version java version "17.0.1" 2021-10-19 LTS Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39) Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
3、安装wiki
[root@ftp-sharedata-server wiki_install]# chmod +x atlassian-confluence-7.13.3-x64.bin [root@ftp-sharedata-server wiki_install]# ./atlassian-confluence-7.13.3-x64.bin Regenerating the font cache Fonts and fontconfig have been installed Unpacking JRE ... Starting Installer ... This will install Confluence 7.13.3 on your computer. OK [o, Enter], Cancel [c] Click Next to continue, or Cancel to exit Setup. Choose the appropriate installation or upgrade option. Please choose one of the following: Express Install (uses default settings) [1], Custom Install (recommended for advanced users) [2, Enter], Upgrade an existing Confluence installation [3] 2 Select the folder where you would like Confluence 7.13.3 to be installed, then click Next. Where should Confluence 7.13.3 be installed? [/opt/atlassian/confluence] /wiki/wiki ##wiki安装目录 Default location for Confluence data [/var/atlassian/application-data/confluence] /wiki/data ##wiki数据存储目录 Configure which ports Confluence will use. Confluence requires two TCP ports that are not being used by any other applications on this machine. The HTTP port is where you will access Confluence through your browser. The Control port is used to Startup and Shutdown Confluence. Use default ports (HTTP: 8090, Control: 8000) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2] 1 ##默认端口号,如果不需要修改输入1,需要修改输入2 Confluence can be run in the background. You may choose to run Confluence as a service, which means it will start automatically whenever the computer restarts. Install Confluence as Service? Yes [y, Enter], No [n] y ##是否开始安装 Extracting files ... Please wait a few moments while we configure Confluence. Installation of Confluence 7.13.3 is complete Start Confluence now? Yes [y, Enter], No [n] y ##是否现在启动 Please wait a few moments while Confluence starts up. Launching Confluence ... Installation of Confluence 7.13.3 is complete Your installation of Confluence 7.13.3 is now ready and can be accessed via your browser. Confluence 7.13.3 can be accessed at http://localhost:8090 Finishing installation ...
4、配置数据库
在另一台机器上,事先安装好mysql
#建立wiki的库 mysql> create database confluence character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) #建立连接用户,设置密码 mysql> GRANT ALL PRIVILEGES ON confluence.* TO'wiki'@'%' IDENTIFIED BY'1911Xhgm..'; Query OK, 0 rows affected, 1 warning (0.00 sec) #设定隔离级别 mysql> SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
5、进行破解
#将confluence关闭 [root@ftp-sharedata-server wiki_install]# service confluence stop #将mysql连接包放入wiki相关目录中 ##注意!:数据库是mysql5.7版本不能使用mysql-connector-java-8的版本,建议使用mysql-connector-java-5.1.39的版本,其他的可能会报错 [root@ftp-sharedata-server wiki_install]# cp mysql-connector-java-5.1.39-bin.jar /wiki/wiki/confluence/WEB-INF/lib/ #备份jar包 [root@ftp-sharedata-server wiki_install]# mv /wiki/wiki/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.4.1.jar /tmp/wiki-jar/ #将jar包拷到电脑本地并改名叫atlassian-extras-2.4 [root@ftp-sharedata-server wiki_install]# sz atlassian-extras-decoder-v2-3.4.1.jar
点击gen生成key,点击patch将atlassian-extras-2.4.jar进行破解
将破解后的atlassian-extras-2.4改回atlassian-extras-decoder-v2-3.4.1.jar,并上传到原wiki目录中
重新启动confluence
[root@ftp-sharedata-server wiki_install]# service confluence start
6、初始化设置
连接数据库
时间会有些长,需要等待一下
URL设置:jdbc:mysql://10.0.16.3:13306/confluence?autoReconnect=true&&useSSL=false
设置管理员账户
关于wiki的一些性能调优
vim /wiki/wiki/bin/setenv.sh CATALINA_OPTS="-Xms4096m -Xmx4096m -XX:+UseG1GC ${CATALINA_OPTS}" #-Xms:confluence可用最大内存大小;-Xmx:confluence可用最小内存大小,为防止confluence网页打开慢,可以将这两个值调高一些 [root@ftp-sharedata-server wiki_install]# cat /wiki/data/confluence.cfg.xml <property name="hibernate.c3p0.acquire_increment">1</property> #连接不够用的时候, 每次增加的连接数 <property name="hibernate.c3p0.idle_test_period">100</property> #空闲测试时间 <property name="hibernate.c3p0.max_size">60</property> #最大连接数 <property name="hibernate.c3p0.max_statements">0</property> #最大执行的命令个数 <property name="hibernate.c3p0.min_size">20</property> #最小连接数 <property name="hibernate.c3p0.timeout">30</property> #超时时间
报错解决
#数据库连接报错 ##报错日志,catalina.out: Thu Mar 24 04:46:30 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. #原因:MySQL在高版本需要指明是否进行SSL连接 #SSL协议提供服务主要: #1)认证用户服务器,确保数据发送到正确的服务器; . #2)加密数据,防止数据传输途中被窃取使用; #3)维护数据完整性,验证数据在传输过程中是否丢失; #解决方案:设置禁用SSL协议,同数据库连接时不再验证服务器,但是这样有很大的安全隐患 #在mysql连接字符串url中加入ssl=false即可: [root@wp-web-server zzf]# vim /opt/wiki/data/confluence.cfg.xml ...... <property name="hibernate.connection.url">jdbc:mysql://10.0.16.3:13306/confluence?useSSL=false</property> ......