介绍
Jira 是一个问题追踪管理系统。可以说是这一领域里的领头羊,其他产品不管开源的还是商业的功能上都难以与之竞争。
系列文章
这一系列文章中的软件是在同一台机器上安装配置的,完整地记录了配置过程。解决了同时部署各种服务之间可能会产生的问题,最终将各种服务整合到一起。每个服务都配置使用域名访问,便于使用。
账号系统未使用 LDAP,因此 Jira 与 GitLab 账号是独立的,Jenkins 与 Mattermost 使用 GitLab 账号登录。
环境
- CentOS 7.6 1810
- Jira 7.13.0
- MySQL 5.7.25
支持版本
官方网站中给出了依赖的第三方组件版本信息,安装前一定要检查使用的第三方版本是否符合要求,不是最新最好,建议选择兼容的最高版本。
Jira 是当前时间 2019/02/03 时最新的版本 7.13.0,MySQL 是 Jira 支持的最高最新版本 5.7.25。
MySQL
安装
1
2
3
4
5
|
rpm -ivh https://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
yum install -y mysql-server
systemctl enable mysqld
systemctl start mysqld
|
设置 root 密码
1
2
3
4
|
sudo grep 'temporary password' /var/log/mysqld.log
# 输入上面提示的密码
mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';
|
注意:密码必须设置地复杂,否则会提示 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
创建 Jira 数据库
1
2
3
4
5
6
7
|
CREATE USER 'jiradbuser'@'localhost' IDENTIFIED BY 'your-jiradb-password';
CREATE DATABASE jiradb CHARACTER SET utf8 COLLATE utf8_bin;
# MySQL 5.6 及以下
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on jiradb.* TO 'jiradbuser'@'localhost' IDENTIFIED BY 'your-jiradb-password';
# MySQL 5.7
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,ALTER,INDEX on jiradb.* TO 'jiradbuser'@'localhost' IDENTIFIED BY 'your-jiradb-password';
flush privileges;
|
注意:MySQL 5.7 使用的权限多了一个 REFERENCES
,如果不正确授权会导致打开 Jira 后只能创建 Business
项目,而不能创建 Software
项目,且进入创建后的项目会报错。
Jira 额外配置
Jira 官方要求 MySQL 增加以下配置:
/etc/my.cnf
在文件最后增加:
1
2
3
|
default-storage-engine=INNODB
max_allowed_packet=256M
innodb_log_file_size=256M
|
JIRA
Installing Jira applications on Linux - Atlassian Documentation
安装
官方下载地址:
https://product-downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-7.13.0-x64.bin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
chmod a+x atlassian-jira-software-7.13.0-x64.bin
./atlassian-jira-software-7.13.0-x64.bin
Unpacking JRE ...
Starting Installer ...
INFO: Created user preferences directory.
INFO: Created system preferences directory in java.home.
This will install JIRA Software 7.13.0 on your computer.
OK [o, Enter], Cancel [c]
o
Choose the appropriate installation or upgrade option.
Please choose one of the following:
Express Install (use default settings) [1], Custom Install (recommended for advanced users) [2, Enter], Upgrade an existing JIRA installation [3]
2
Where should JIRA Software be installed?
[/opt/atlassian/jira]
Default location for JIRA Software data
[/var/atlassian/application-data/jira]
Configure which ports JIRA Software will use.
JIRA requires two TCP ports that are not being used by any other
applications on this machine. The HTTP port is where you will access JIRA
through your browser. The Control port is used to startup and shutdown JIRA.
Use default ports (HTTP: 8080, Control: 8005) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2]
2
HTTP Port Number
[8080]
9080
Control Port Number
[8005]
9005
JIRA can be run in the background.
You may choose to run JIRA as a service, which means it will start
automatically whenever the computer restarts.
Install JIRA as Service?
Yes [y, Enter], No [n]
y
Details on where JIRA Software will be installed and the settings that will be used.
Installation Directory: /opt/atlassian/jira
Home Directory: /var/atlassian/application-data/jira
HTTP Port: 9080
RMI Port: 9005
Install as service: Yes
Install [i, Enter], Exit [e]
i
Extracting files ...
Please wait a few moments while JIRA Software is configured.
Installation of JIRA Software 7.13.0 is complete
Start JIRA Software 7.13.0 now?
Yes [y, Enter], No [n]
y
Please wait a few moments while JIRA Software starts up.
Launching JIRA Software ...
Installation of JIRA Software 7.13.0 is complete
Your installation of JIRA Software 7.13.0 is now ready and can be accessed
via your browser.
JIRA Software 7.13.0 can be accessed at http://localhost:9080
Finishing installation ...
|
注意:如果在同一台机器上已安装 GitLab,那么建议配置端口时跳过 GitLab 占用的 8080,修改为其他端口如 9080。选用端口时不要用已使用的端口,也不要使用浏览器禁用的不安全端口,如 6000
。Chrome 非安全端口限制 | javasgl
防火墙
1
2
|
firewall-cmd --zone=public --add-port=9080/tcp --permanent
firewall-cmd --reload
|
MySQL Connector
在安装过程中如果选择使用 MySQL,连接测试时会提示 Could not find driver with class name: com.mysql.jdbc.Driver
,需要安装驱动。
下拉框中保留默认的 Platform Independent
即可。
下载 mysql-connector-java-5.1.47.tar.gz
1
2
|
tar -xzf mysql-connector-java-5.1.47.tar.gz
cp mysql-connector-java-5.1.47/mysql-connector-java-5.1.47-bin.jar /opt/atlassian/jira/lib/
|
启动停止
1
2
|
$ sudo /etc/init.d/jira start
$ sudo /etc/init.d/jira stop
|
域名
默认 Jira 使用独立的端口,但对于团队使用非常不便,因此可以使用反向代理,将域名的访问转发到 Jira 端口。
Nginx 安装可以参考 GitLab 安装配置 - 狂飙 中的 同服务器共享 Nginx
一节。
在安装完 Nginx 后,可以增加以下配置:
vi /etc/nginx/conf.d/jira.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
server {
listen 80;
server_name jira.company.com;
client_max_body_size 60M;
client_body_buffer_size 512k;
location / {
proxy_pass
http://127.0.0.1:9080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
|
使用 systemctl restart nginx
重启 Nginx 查看结果。
配置完成后可以直接省略端口,直接使用 http://jira.company.com
访问。