装一个知识库进行测试,详细步骤如下:
1、如果CentOS是最小安装,需要先安装图形界面。
可参考2019-05-14 CentOS 7 安装图形界面
2、安装jdk,下载的最近版本是jdk-8u202-linux-x64.tar.gz, 解压到/usr/local下面。 (BTW,本文相关软件可以在网盘下载: https://pan.baidu.com/s/1joJbyQ5-kfvYz-7uBvDPjQ 密码:r0vf)
sudo tar zxvf jdk-8u202-linux-x64.tar.gz -C /usr/local/
sudo ln -s /usr/local/jdk1.8.0_202/ /usr/local/jdk
设置环境变量:
sudo vim /etc/profile
#在后面增加Java目录
JAVA_HOME=/usr/local/jdk
export JRE_HOME=/usr/local/jdk/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
#看下效果
sudo source /etc/profile
[root@localhost axing]# java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
3、导入confluence安装包
[root@localhost axing]# chmod +x atlassian-confluence-6.3.1-x64.bin
[root@localhost axing]# ll
total 779780
-rwxr-xr-x. 1 root root 604450053 May 18 19:52 atlassian-confluence-6.3.1-x64.bin
-rw-r--r--. 1 axing axing 194042837 May 18 19:31 jdk-8u202-linux-x64.tar.gz
[root@localhost axing]# ./atlassian-confluence-6.3.1-x64.bin
Unpacking JRE ...
Starting Installer ...
#此部分略过。。。期间有几次选项,可以全部回车
Launching Confluence ...
Installation of Confluence 6.3.1 is complete
Your installation of Confluence 6.3.1 is now ready and can be accessed via
your browser.
Confluence 6.3.1 can be accessed at http://localhost:8090
Finishing installation ...
到主机上进入图形界面 (init 5), 打开firefox, 访问localhost:8090,可以看到下面图形,说明第一步已经完成。
4、web界面配置
语言选择中文,语言切换很方便,装完以后随时都能切换。
选择正式安装装,后面我们破解。
安装插件:
下一步,看到机器码(服务器ID)后先暂停在这一步:
5、根据机器码进行破解
5.1 拷贝安装目录下的atlassian-extras-decoder-v2-3.2.jar 文件,改名为atlassian-extras-2.4.jar , 拷贝这个文件到windows主机上。
如果没有装jre的话,还需要安装一下才能执行.jar的文件。
sudo cp /opt/atlassian/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.2.jar atlassian-extras-2.4.jar
5.2 运行破解程序
这里要输入server id,就是刚才记下来的那个,patch!那个地方选择导入atlassian-extras-2.4.jar 文件,然后就可以生成key了。
其他地方保持不变,名字如果是空的随便写。
5.3 把atlassian-extras-2.4.jar 文件拷回服务器,改回原来的名字,覆盖拷贝
cp atlassian-extras-decoder-v2-3.2.jar /opt/atlassian/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.2.jar
5.4 重启confluence
[root@localhost axing]# sh /opt/atlassian/confluence/bin/stop-confluence.sh
executing using dedicated user
If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide
/opt/atlassian/confluence/bin/setenv.sh: line 33: cd: /home/axing: Permission denied
Server startup logs are located in /opt/atlassian/confluence/logs/catalina.out
---------------------------------------------------------------------------
Using Java: /opt/atlassian/confluence/jre//bin/java
2019-05-19 00:00:39,423 INFO [main] [atlassian.confluence.bootstrap.SynchronyProxyWatchdog] A Context element for ${confluence.context.path}/synchrony-proxy is found in /opt/atlassian/confluence/conf/server.xml. No further action is required
---------------------------------------------------------------------------
Using CATALINA_BASE: /opt/atlassian/confluence
Using CATALINA_HOME: /opt/atlassian/confluence
Using CATALINA_TMPDIR: /opt/atlassian/confluence/temp
Using JRE_HOME: /opt/atlassian/confluence/jre/
Using CLASSPATH: /opt/atlassian/confluence/bin/bootstrap.jar:/opt/atlassian/confluence/bin/tomcat-juli.jar
Using CATALINA_PID: /opt/atlassian/confluence/work/catalina.pid
Tomcat stopped.
[root@localhost axing]# sh /opt/atlassian/confluence/bin/start-confluence.sh
To run Confluence in the foreground, start the server with start-confluence.sh -fg
executing using dedicated user: confluence
If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide
/opt/atlassian/confluence/bin/setenv.sh: line 33: cd: /home/axing: Permission denied
Server startup logs are located in /opt/atlassian/confluence/logs/catalina.out
---------------------------------------------------------------------------
Using Java: /opt/atlassian/confluence/jre//bin/java
2019-05-19 00:00:47,852 INFO [main] [atlassian.confluence.bootstrap.SynchronyProxyWatchdog] A Context element for ${confluence.context.path}/synchrony-proxy is found in /opt/atlassian/confluence/conf/server.xml. No further action is required
---------------------------------------------------------------------------
Using CATALINA_BASE: /opt/atlassian/confluence
Using CATALINA_HOME: /opt/atlassian/confluence
Using CATALINA_TMPDIR: /opt/atlassian/confluence/temp
Using JRE_HOME: /opt/atlassian/confluence/jre/
Using CLASSPATH: /opt/atlassian/confluence/bin/bootstrap.jar:/opt/atlassian/confluence/bin/tomcat-juli.jar
Using CATALINA_PID: /opt/atlassian/confluence/work/catalina.pid
Tomcat started.
5.5 在Confluence web界面接着输入授权码,点击下一步,到选择数据库,我们选择使用外部数据库 - mysql,当然,使用内部数据库也行。
这时候提示需要数据库驱动:
需要把mysql-connector-java-5.0.8-bin.jar 文件安装到java目录,重启confluence
[root@localhost axing]# cp mysql-connector-java-5.0.8-bin.jar /opt/atlassian/confluence/lib/
[root@localhost axing]# /etc/init.d/confluence restart
executing using dedicated 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 /opt/atlassian/confluence/logs/catalina.out
---------------------------------------------------------------------------
Using Java: /opt/atlassian/confluence/jre//bin/java
2019-05-19 00:26:14,395 INFO [main] [atlassian.confluence.bootstrap.SynchronyProxyWatchdog] A Context element for ${confluence.context.path}/synchrony-proxy is found in /opt/atlassian/confluence/conf/server.xml. No further action is required
---------------------------------------------------------------------------
Using CATALINA_BASE: /opt/atlassian/confluence
Using CATALINA_HOME: /opt/atlassian/confluence
Using CATALINA_TMPDIR: /opt/atlassian/confluence/temp
Using JRE_HOME: /opt/atlassian/confluence/jre/
Using CLASSPATH: /opt/atlassian/confluence/bin/bootstrap.jar:/opt/atlassian/confluence/bin/tomcat-juli.jar
Using CATALINA_PID: /opt/atlassian/confluence/work/catalina.pid
Tomcat stopped.
To run Confluence in the foreground, start the server with start-confluence.sh -fg
executing using dedicated user: confluence
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 /opt/atlassian/confluence/logs/catalina.out
---------------------------------------------------------------------------
Using Java: /opt/atlassian/confluence/jre//bin/java
2019-05-19 00:26:16,085 INFO [main] [atlassian.confluence.bootstrap.SynchronyProxyWatchdog] A Context element for ${confluence.context.path}/synchrony-proxy is found in /opt/atlassian/confluence/conf/server.xml. No further action is required
---------------------------------------------------------------------------
Using CATALINA_BASE: /opt/atlassian/confluence
Using CATALINA_HOME: /opt/atlassian/confluence
Using CATALINA_TMPDIR: /opt/atlassian/confluence/temp
Using JRE_HOME: /opt/atlassian/confluence/jre/
Using CLASSPATH: /opt/atlassian/confluence/bin/bootstrap.jar:/opt/atlassian/confluence/bin/tomcat-juli.jar
Using CATALINA_PID: /opt/atlassian/confluence/work/catalina.pid
Tomcat started.
6、安装mysql数据库
MySQL 被 Oracle 收购后,CentOS 的镜像仓库中提供的默认的数据库变为了 MariaDB,我们要用mysql首先添加yum源
$wget 'https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm'
$sudo rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
$sudo yum install mysql-community-server
#默认安装5.7版本
#设置开机启动,运行mysql
systemctl enable mysqld
systemctl start mysqld
systemctl status mysqld
[root@localhost axing]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2019-05-19 00:32:55 BST; 12s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 16590 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 16496 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 16592 (mysqld)
Tasks: 27
CGroup: /system.slice/mysqld.service
└─16592 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
May 19 00:32:49 localhost.localdomain systemd[1]: Starting MySQL Server...
May 19 00:32:55 localhost.localdomain systemd[1]: Started MySQL Server.
现在数据库已经在运行了,用下面命令看到初始密码后改成自己的:
[root@localhost axing]# sudo grep 'temporary password' /var/log/mysqld.log
2019-05-18T23:32:51.285571Z 1 [Note] A temporary password is generated for root@localhost: *EionhU6a_T6
[root@localhost axing]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.26
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
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 'MyPassword';
Query OK, 0 rows affected (0.01 sec)
mysql>
运行数据库安全设置,删除匿名用户,禁止root远程登录,删除test数据库等:
mysql_secure_installation
设置字符集,修改/etc/my.cnf,在[mysqld]标签下添加
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
重启mysql, systemctl restart mysqld,进入mysql看下:
mysql> show variables like "%character%";show variables like "%collation%";
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_unicode_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)
mysql>
为confluence创建数据,用户名和密码:
mysql> create database confluence default character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on confluence.* to 'confluence'@'%' identified by 'ComplexPassword';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
7、接着在图形界面配置数据库连接,现在我们有了mysql驱动,用户名和密码,按照提示输入即可,第一次连接数据库稍有点慢。
8、最后一步提示安装成功
9、其他
进入confluence后,系统可能会提示几个错误,比如InnoDB Log File Size, Max Allowed Packet。修复这两个错误,在/etc/my.cnf文件里mysqld里增加
max_allowed_packet=512M
innodb_log_file_size=2G
然后重启mysql,记得重启之前到/var/lib/mysql目录下面,把当前生成的日志文件删掉 rm ib_logfile* ,否则mysql重启可能失败。
并且,千万不要删除ibdata文件。
confluence 停止,启动,重启的命令:
sh /opt/atlassian/confluence/bin/stop-confluence.sh
sh /opt/atlassian/confluence/bin/start-confluence.sh
/etc/init.d/confluence restart
防火墙设置:
firewalld 开启,允许tcp 8090端口访问。
需要的话请参考:
2019-03-29 CentOS防火墙firewalld使用
2019-04-20 Ansible CentOS firewalld 剧本
10、现在可以远程访问了,enjoy!