先决条件
Jira or Confluence 已安装并正在运行,但不会在启动时自动启动。是通过 .zip 包而不是 .bin 安装程序安装的
解决方案
- 登录到机器并提升到 root 用户
- 以 root 身份创建以下服务配置:
# Jira
touch /lib/systemd/system/jira.service
chmod 664 /lib/systemd/system/jira.service
# Confluence
touch /lib/systemd/system/confluence.service
chmod 664 /lib/systemd/system/confluence.service
- 以 root 身份编辑服务配置
# Jira
vi /lib/systemd/system/jira.service
# Confluence
vi /lib/systemd/system/confluence.service
- 通过将其放入
jira.service
orconfluence.service
来定义服务配置
- Jira
[Unit] Description=Atlassian Jira After=network.target [Service] Type=forking User=jira LimitNOFILE=20000 PIDFile=/opt/atlassian/jira/work/catalina.pid ExecStart=/opt/atlassian/jira/bin/start-jira.sh ExecStop=/opt/atlassian/jira/bin/stop-jira.sh [Install] WantedBy=multi-user.target
- Confluence
[Unit] Description=Confluence After=network.target [Service] Type=forking User=confluence PIDFile=/opt/atlassian/confluence/work/catalina.pid ExecStart=/opt/atlassian/confluence/bin/start-confluence.sh ExecStop=/opt/atlassian/confluence/bin/stop-confluence.sh TimeoutSec=200 LimitNOFILE=32768 LimitNPROC=4096 [Install] WantedBy=multi-user.target
根据实际情况 修改
User=
和 文件路径: full path for your installation folder
⚠️ Do not run Jira in the foreground, as this will prevent the file ‘catalina.out’ from being created.
⚠️ 此外,我们建议禁用 SELinux 策略或彻底验证它们
在强制模式下运行SELinux时,可能需要将 Confluence 的启动/停止传递给 bash shell,如下所示:
ExecStart=/bin/bash /opt/atlassian/confluence/bin/start-confluence.sh
ExecStop=/bin/bash /opt/atlassian/confluence/bin/stop-confluence.sh
- 以 root 身份启用并启动服务
# 重新加载 systemd 配置
systemctl daemon-reload
# 将 Jira 服务设置为开机自启动
systemctl enable jira.service
# 启动 Jira 服务:
systemctl start jira.service
# 关闭 Jira 服务:
systemctl stop jira.service
# 检查 Jira 服务状态:
systemctl status jira.service
如果是 confluence ,就换成
confluence.service