环境说明
- 操作系统: Centos
- 安装 Jira 版本: 8.13.4
- 使用数据库: Mysql 5.7
- jdk 版本: openjdk 1.8
官方 jira 最新版本查看地址
环境初始化
安装 jdk
1
2
3
4
5
6
|
yum install -y java-1.8.0-openjdk
[root@jira ~]# java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)
|
安装 mysql 5.7
设置 yum 源
1
2
3
4
5
6
7
8
|
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
yum localinstall mysql57-community-release-el7-11.noarch.rpm -y
[root@jira ~]# yum repolist enabled | grep "mysql.*-community.*" # 检查 yum 源是否生效
mysql-connectors-community/x86_64 MySQL Connectors Community 185
mysql-tools-community/x86_64 MySQL Tools Community 123
mysql57-community/x86_64 MySQL 5.7 Community Server 484
|
yum 安装
1
|
yum install -y mysql-community-server
|
启动并设置开机自启动
1
2
3
4
|
systemctl start mysqld \
&& systemctl status mysqld
systemctl enable mysqld
|
初始化数据库
查看日志文件,获取 mysql root
密码
1
2
|
grep 'temporary password' /var/log/mysqld.log
2021-02-21T04:37:14.500441Z 1 [Note] A temporary password is generated for root@localhost: p!o2lkYqNXQu
|
获得密码 p!o2lkYqNXQu
使用获取到的 root 密码初始化数据库
1
2
3
4
5
6
|
mysql -uroot -p # 连接数据库
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password'; # 设置新密码
mysql> flush privileges;
|
创建 jira 所使用 db
jira 初始化数据库相关 参考文档
1
|
mysql> CREATE DATABASE `jiradb` CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; # 创建 db
|
创建 jira 独立连接用户, 提高安全性。
1
2
3
4
5
|
mysql> set global validate_password_policy=0; # 临时修改用户密码的安全级别
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,ALTER,INDEX on jiradb.* TO jira_user@'%' IDENTIFIED BY '12345678'; # 新建 用户 及 设置用户密码
mysql> flush privileges;
|
mysql 配置文件添加参数
1
2
3
4
5
6
7
8
9
10
11
12
|
vi /etc/my.cnf
[mysqld]
default-storage-engine=INNODB
character_set_server=utf8mb4
innodb_default_row_format=DYNAMIC
innodb_large_prefix=ON
innodb_file_format=Barracuda
innodb_log_file_size=2G
sql_mode=NO_AUTO_VALUE_ON_ZERO
service mysqld restart
|
jira 安装
配置完上面的 数据库初始化后,我们就可以进行安装 jira 相关的配置了
1
2
3
4
5
|
wget https://cdn.treesir.pub/application/jira/atlassian-jira-software-8.13.4-x64.bin # 下载软件
chmod a+x atlassian-jira-software-8.13.4-x64.bin # 添加可执行权限
./atlassian-jira-software-8.13.4-x64.bin
|
jira 添加 mysql jar 包驱动
1
2
3
4
5
|
wget https://cdn.treesir.pub/application/jira/mysql-connector-java-5.1.49.tar.gz
tar xf mysql-connector-java-5.1.49.tar.gz
cp mysql-connector-java-5.1.49/mysql-connector-java-5.1.49-bin.jar /opt/atlassian/jira/atlassian-jira/WEB-INF/lib
|
配置 破解补丁
1
2
3
4
5
6
7
8
9
|
wget https://cdn.treesir.pub/application/jira/atlassian-agent-v1.2.3.zip
yum install unzip -y
unzip atlassian-agent-v1.2.3.zip
mkdir -p /opt/atlassian/jira/jar
cp atlassian-agent-v1.2.3/atlassian-agent.jar /opt/atlassian/jira/jar/
|
修改配置文件
在 JAVA_OPTS
一行中添加 -javaagent:/opt/atlassian/jira/jar/atlassian-agent.jar
1
2
3
4
5
6
7
|
cd /opt/atlassian/jira/bin
vim setenv.sh # 编辑配置文件
JAVA_OPTS="-javaagent:/opt/atlassian/jira/jar/atlassian-agent.jar -Xms${JVM_MINIMUM_MEMORY} -Xmx${JVM_MAXIMUM_MEMORY} ${JVM_CODE_CACHE_ARGS} ${JAVA_OPTS} ${JVM_REQUIRED_ARGS} ${DISABLE_NOTIFICATIONS} ${JVM_SUPPORT_RECOMMENDED_ARGS} ${JVM_EXTRA_ARGS} ${JIRA_HOME_MINUSD} ${START_JIRA_JAVA_OPTS}"
service jira stop \
&& service jira start # 重启服务
|
dashboard 初始化配置
记住 server id
使用工具 获取 license
复制服务器 id 放至 -s 之后
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
cd /opt/atlassian/jira/jar/
/opt/atlassian/jira/jre/bin/java -jar atlassian-agent.jar -p jira -m aaa@bbb.com -n my_name -o https://zhile.io -s BEVE-RLKR-E429-3JWB
====================================================
======= Atlassian Crack Agent =======
======= https://zhile.io =======
======= QQ Group: 30347511 =======
====================================================
Your license code(Don't copy this line!!!):
AAABfw0ODAoPeJx9klFrwjAUhd/7Kwp7TrVVnAqBzTaDblWHVfc40nrVjDYtN6mb+/WLths6RQiEh
JyT75577+JK2k+Q2J5ru51htzdsd20/ntte23OtDQLIbVGWgE4kUpAK5vsSJjwH6k/HYzbzw8fI8
hG4FoUMuAZ6EJK2R4z8hiQAlaIoDyq6kJnIhYaVndUCO9nbW61LNWy1vrciA0cU1pgLqUFymQL7K
gXum9/6A9K+N8v6EMh/KdlK1NaTKByHcxZYkypPAKfrhQJUlPzB3fAqsVhVqXYOB6KKtf7kCM6F0
Y23PNViB1RjBWdZnt43NS+N24HYs9iOZ9UxT7rmmQJrihsuhaqvLnLxC6mNHzP5ZJRz/pAkiZMWe
c11nfb0/xv4seaoARuMJrAwoFEYxGxCIrfndvr9XqfXdV33LP9rLY8Bd4BGPmJLRmbRy4ywrjcgn
ee30bVJu+zha4Xpliv4P2enYjBDgiUK1ZRnQOkV2Ca1I2O+f5dm/wFMhgkNMCwCFDyreObHK4tWu
NBWoOQpy/gWRwsUAhR9tkejACVL+tc1RzzSopum6rxwfg==X02im
|
confluence 安装
confluence 安装过程与 jira 安装大致相同 (数据驱动+破解补丁) 如在一台机器上可使用同一个破解补丁,只要保证端口不冲突即可。下面展示与 jira 安装的 不同项
。
confluence 安装与 jira 安装不同项展示
-
安装包 下载
1
|
wget https://cdn.treesir.pub/application/jira/atlassian-confluence-7.4.1-x64.bin
|
-
数据库隔离级别
1
2
3
4
5
6
7
8
9
10
11
|
# 编辑 my.cnf 添加配置,修改事务提交级别
vi /etc/my.cnf
[mysqld]
transaction-isolation=READ-COMMITTED
mysql> SET GLOBAL tx_isolation='READ-COMMITTED';
mysql> select @@tx_isolation;
mysql> CREATE DATABASE `confluence_db` CHARACTER SET utf8 COLLATE utf8_bin;
cp mysql-connector-java-5.1.49/mysql-connector-java-5.1.49-bin.jar /opt/atlassian/confluence/confluence/WEB-INF/lib
|
-
setenv.sh 文件
1
2
|
# javaagent 为破解补丁地址
export JAVA_OPTS="-javaagent:/opt/atlassian/jira/jar/atlassian-agent.jar ${JAVA_OPTS}" #最上边添加这行配置
|
-
使用破解补丁获取 license
1
|
/opt/atlassian/confluence/jre/bin/java -jar /opt/atlassian/jira/jar/atlassian-agent.jar -p conf -m aaa@bbb.com -n my_name -o https://zhile.io -s B6RI-Q8HH-ZDR0-FDZ1 # -s 后接你服务器id
|
问题记录
-
启动权限问题解决
1
2
3
4
5
|
chown confluence:confluence -R /opt/atlassian/confluence/
sudo chown -R confluence:confluence /opt/atlassian/confluence
sudo chown -R confluence:confluence /home/confluence
sudo chmod -R u=rwx,g=rx,o=rx /opt/atlassian/confluence
sudo chmod -R u=rwx,g=rx,o=rx /home/confluence
|
-
如安装过程中,需要卸载安装。
1
2
3
4
5
|
/opt/atlassian/confluence/uninstall
rm -rf /var/atlassian/application-data/confluence
/opt/atlassian/jira/uninstall
rm -rf /var/atlassian/application-data/jira
|
配置 nginx 代理
Jira 默认监听在主机中的 8080
端口上, 为了 方便记忆
通常会修改成域名且 不带后面的端口号
的形式进行访问。不带端口号的话,这样就是要使用 80
or 443
端口号了,显然我们这里是内网,不需要什么安全性,只需要使用 80 端口就行。如果让 Jira 监听在 80 端口上的话,显的有些浪费,为了不保证浪费此时我们就可以使用另外一个工具 nginx
配置虚拟机主机来实现反代, 这样就可以同时将 80 端口提供给 多个服务
进行使用了。
修改 Jira 配置文件
1
2
3
4
5
6
|
vi /opt/atlassian/jira/conf/server.xml
<Connector port="8080" relaxedPathChars="[]|" relaxedQueryChars="[]|{}^\`"<>"
maxThreads="150" minSpareThreads="25" connectionTimeout="20000" enableLookups="false"
maxHttpHeaderSize="8192" protocol="HTTP/1.1" useBodyEncodingForURI="true" redirectPort="8443"
acceptCount="100" disableUploadTimeout="true" bindOnInit="false" proxyName="jira.treesir.pub" proxyPort="80"/>
|
添加 proxyName
& proxyPort
参数后, 重启服务。
1
2
|
service jira stop \
&& service jira start
|
Nginx 添加虚拟机主机
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
cat /etc/nginx/conf.d/jira.conf
server {
listen 80;
server_name jira.treesir.pub;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.5.188:8080;
client_max_body_size 0;
}
}
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful # 检查配置文件
|
192.168.5.188:8080
为你 Jira 的地址,不要配置 127.0.0.1:8080
这样好像会报错。