Confluence是一个专业的企业知识管理与协同软件,也可以用于构建企业wiki。使用简单,但它强大的编辑和站点管理特征能够帮助团队成员之间共享信息、文档协作、集体讨论,信息推送。具体介绍见官网 https://www.atlassian.com/software/confluence,下面介绍一下该软件的离线安装和注册方法,在线安装也可参考。
1、Mysql的离线安装
我们一般使用Mysql进行数据存储,如果已经有mysql环境,跳过这一步。
因为环境是离线环境,因此这里选择离线安装的方式。如果有互联网环境,建议使用在线安装,方便得多。
本人的安装环境为Red Hat的Linux版本,centos版本也可以参考使用。
(1)到mysql官网(https://dev.mysql.com/downloads/mysql/)下载对应的版本,我使用的是5.7.25
(2)将安装压缩包mysql-5.7.25-linux-glibc2.12-x86_64.tar上传到指定目录下,并依次执行如下的解压命令:
tar -xvf mysql-5.7.25-linux-glibc2.12-x86_64.tar
可以得到mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz文件后,再解压该文件:
tar -zxvf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
解压后生成mysql-5.7.25-linux-glibc2.12-x86_64目录
(3)创建数据库的数据目录、日志目录和临时目录:
# 数据目录
mkdir /xxx/mysql-5.7.25-linux-glibc2.12-x86_64/data
# 日志目录
mkdir /xxx/mysql-5.7.25-linux-glibc2.12-x86_64/log
# 临时目录
mkdir /xxx/mysql-5.7.25-linux-glibc2.12-x86_64/tmp
(4)在etc目录下创建my.cnf配置文件:
touch /etc/my.cnf
my.cnf的配置内容如下(粘贴后根据实际情况进行修改):
# For advice on how to change settings please see
#http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[client]
port = 3306
socket = /xxx/mysql-5.7.25-linux-glibc2.12-x86_64/tmp/mysql.sock
[mysqld]
character-set-server=utf8
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/xxx/mysql-5.7.25-linux-glibc2.12-x86_64/data
socket=/xxx/mysql/mysql-5.7.25-linux-glibc2.12-x86_64/tmp/mysql.sock
log-bin=/xxx/mysql-5.7.25-linux-glibc2.12-x86_64/log/mysql-bin.log
max_binlog_size=200M
server-id=1
innodb_log_file_size=256M
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
bind-address=0.0.0.0
log-error=/xxx/mysql-5.7.25-linux-glibc2.12-x86_64/log/error.log
pid-file=/xxx/mysql-5.7.25-linux-glibc2.12-x86_64/tmp/mysqld.pid
default-time_zone='+8:00'
lower_case_table_names=1
#sql_mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
innodb_lock_wait_timeout = 500
max_connections=2000
wait_timeout=7200
interactive_timeout=7200
max_allowed_packet=1024m
#max_connections = 1000
transaction-isolation= READ-COMMITTED
default-storage-engine=INNODB
table_open_cache=128
max_connections=2000
max_connect_errors=6000
innodb_file_per_table=1
innodb_buffer_pool_size=1G
#max_allowed_packet=64M
transaction_isolation=READ-COMMITTED
innodb_flush_method=O_DIRECT
innodb_lock_wait_timeout=1800
innodb_flush_log_at_trx_commit=0
sync_binlog=0
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
skip-name-resolve
[mysql]
default-character-set=utf8
#lower_case_table_names=1
其中有几个地方需要注意:
innodb_log_file_size=256M 这个设置的大一些,否则confluence会有告警信息。
xxx的几处地方,根据实际路径进行填写
(5)初始化数据库:
进入/xxx/mysql-5.7.25-linux-glibc2.12-x86_64/bin/
执行 ./mysqld --initialize
(6)设置启动mysql服务:
cp /xxx/mysql-5.7.25-linux-glibc2.12-x86_64/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
启动mysql服务
service mysqld start
(7)获取初始密码:
在log目录下有一个error.log,里面有一段类似如下内容:
[Note] A temporary password is generated for root@localhost: K8,lrqfd/4Ja
那么初始密码就是:
K8,lrqfd/4Ja
注意:不同机器操作的初始密码肯定是不一样的,这里只是以本人的为例。
(8)重置密码:
mysql -u root -p
set password for root@localhost=password("xxxxxx");
(9)创建库和用户:
#建库
create database confluence default character set utf8 collate utf8_bin;
#建用户
create user 'confluence'@'127.0.0.1' identified by 'Password@123'
#授权
grant all privileges on confluence.* to 'confluence'
flush privileges
2、Confluence安装
(1)下载相关工具
安装包:
https://downloads.atlassian.com/software/confluence/downloads/atlassian-confluence-6.13.0-x64.bin
注册机:
https://files.cnblogs.com/files/Javame/confluence%E7%A0%B4%E8%A7%A3%E5%B7%A5%E5%85%B7.zip
mysql驱动:
https://github.com/2224132867/mysql-connector-java-5.1.44-bin.jar
(2)安装程序
将安装包上传到指定位置,执行即可。
chmod +x atlassian-confluence-6.12.1-x64.bin
./atlassian-confluence-6.12.1-x64.bin
安装的时候选择自定义的模式,可以指定端口,存储目录等信息。
Where should Confluence 6.13.0 be installed?
[/opt/atlassian/confluence]
/xxx/confluence/confluence
Default location for Confluence data
[/var/atlassian/application-data/confluence]
/xxx/confluence/confluence-data
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]
18090
Use default ports (HTTP: 8090, Control: 8000) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2]
2
HTTP Port Number
[8090]
18090
Control Port Number
[8000]
18000
(3)注册
将该包复制出来,传到本地atlassian-extras-decoder-v2-3.4.1.jar
mv /xxx/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.4.1.jar /xxx/atlassian-extras-2.4.jar
在本地打开注册机confluence_keygen.jar,点击.patch,选择atlassian-extras-2.4.jar文件,打开,注册成功。
将注册成功之后的atlassian-extras-2.4.jar传到服务器上,并替换掉atlassian-extras-decoder-v2-3.4.1.jar
重新授权:
chmod a+x+w+r atlassian-extras-decoder-v2-3.4.1.jar
重启:
进入到 /xxx/confluence/confluence/bin目录,
停止服务 ./stop-confluence.sh
启动服务 ./start-confluence.sh
配置:
访问ip+端口,进行配置即可。其中数据库信息使用上面的即可。
其中有一步需要输入密钥,此时还是运行注册机,输入服务ID,name随便写,点击gen按钮,将生成的密钥复制即可。
问题排查:
如果有问题,查看日志即可,日志目录/xxx/confluence/confluence-data/logs