Kenta's Pumpkins

  • 首页
  • API和小工具
  • Github
  1. 首页
  2. 软件们
  3. 正文

Jira安装配置记录

2020年10月10日 511点热度 1人点赞 0条评论

环境

  • Ubuntu 20.04
  • PostgreSql 12

准备操作

如果是内外环境,比如开发机无法直连,先设置下出口代理

export http_proxy="...."
export https_proxy="...."

安装Postgres

导入官方仓库密钥

sudo apt-get install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

更新软件源并安装

安装前请先前往 官方文档 确认可以用来安装Jira的数据库的版本。

(由于自己服务器上其他共用数据库的应用有硬性要求,这里就安装12版本了,请根据需求自行调整)

sudo apt-get update && apt-get install postgresql-12

配置数据库

安装完成后切换到管理用户postgres

su -l postgres

通过SHOW命令获取配置文件位置:

psql -U postgres -c 'SHOW config_file'
# 输出如下结果
config_file 
-----------------------------------------
/etc/postgresql/12/main/postgresql.conf
(1 row)

暴露Postgres服务以便其他节点使用

echo "listen_addresses = '*'" >> /etc/postgresql/12/main/postgresql.conf

通过SHOW命令获取hba文件位置:

psql -U postgres -c 'SHOW hba_file'
# 输出如下结果
hba_file
-------------------------------------
 /etc/postgresql/12/main/pg_hba.conf
(1 row)

编辑pg_hba.conf,找到如下记录:

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

将原先的本地网段127.0.0.1/32改为Jira节点所在网段,或者0.0.0.0/0以开启远程范围权限:

# IPv4 local connections:
host    all             all             0.0.0.0/0               md5

保存文件,重启Postgres服务

# 切回具有sudo权限的用户执行
sudo service postgresql restart

回到数据库管理用户postgres,创建Jira使用的数据库用户

postgres@test:~$ createuser --interactive --pwprompt
Enter name of role to add: <用户名>
Enter password for new role: <密码>
Enter it again: <再写一遍密码>
Shall the new role be a superuser? (y/n) n # 是否为超级用户 — 否
Shall the new role be allowed to create databases? (y/n) n # 是由允许创建数据库 — 否
Shall the new role be allowed to create more new roles? (y/n) n # 是否允许创建用户 — 否

创建Jira使用的数据库(以官方文档为准)

postgres@test:~$ psql
psql (12.4 (Ubuntu 12.4-0ubuntu0.20.04.1))
Type "help" for help.

postgres=# CREATE DATABASE <数据库名> WITH ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;
CREATE DATABASE
postgres=# GRANT ALL PRIVILEGES ON DATABASE <数据库名> TO <用户名>;
postgres-# \q

安装Jira

准备工作

安装OpenJDK的依赖:fontconfig

apt-get install fontconfig -y

前往官方下载页,获取Linux 64 Bit版本安装文件。

赋予执行权限并安装

chmod +x ./atlassian-jira-software-8.13.0-x64.bin
./atlassian-jira-software-8.13.0-x64.bin
Unpacking JRE ...
Starting Installer ...

This will install Jira Software 8.13.0 on your computer.
OK [o, Enter], Cancel [c]
o # 输入 'o' 开始安装
Click Next to continue, or Cancel to exit Setup.

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 # 输入 '2' 进入自定义安装模式

Select the folder where you would like Jira Software to be installed.
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]
8601 # 网页端口
Control Port Number
[8005]
8602 # 管理端口

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 # 输入 'y' 将Jira安装为系统服务

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: 8601
RMI Port: 8602
Install as service: Yes
Install [i, Enter], Exit [e]
i # 输入 'i' 开始安装

Extracting files ...


Please wait a few moments while Jira Software is configured.

Installation of Jira Software 8.13.0 is complete
Start Jira Software 8.13.0 now?
Yes [y, Enter], No [n]
n # 输入 'n' 暂时不启动Jira(还有要修改的配置)

Installation of Jira Software 8.13.0 is complete
Your installation of Jira Software 8.13.0 is now ready.
Finishing installation ...

补全Jira的服务控制脚本

编辑/etc/init.d/jira,在#!/bin/bash后追加以下内容

### BEGIN INIT INFO
# Provides: jira
# Required-Start: $network $local_fs $syslog
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: JIRA Server
# Description: JIRA Server
### END INIT INFO

配置Jira

绕过注册

获取注册代理 https://gitee.com/pengzhile/atlassian-agent/releases,并解压到合适的位置

tar -xzf ./atlassian-agent-v1.2.3.tar.gz -C /opt

编辑Jira环境变量,注入代理

echo 'export JAVA_OPTS="-javaagent:/opt/atlassian-agent-v1.2.3/atlassian-agent.jar ${JAVA_OPTS}"' \
  >> /opt/atlassian/jira/bin/setenv.sh

外网加速

如果Jira需要连接Github等外网服务,可以使用下面命令应用代理加速

echo 'export JAVA_OPTS="-Dhttp.proxyHost=<代理地址> ${JAVA_OPTS}"' \
  >> /opt/atlassian/jira/bin/setenv.sh;
echo 'export JAVA_OPTS="-Dhttp.proxyPort=<代理端口> ${JAVA_OPTS}"' \
  >> /opt/atlassian/jira/bin/setenv.sh;
echo 'export JAVA_OPTS="-Dhttps.proxyHost=<代理地址> ${JAVA_OPTS}"' \
  >> /opt/atlassian/jira/bin/setenv.sh;
echo 'export JAVA_OPTS="-Dhttps.proxyPort=<代理端口> ${JAVA_OPTS}"' \
  >> /opt/atlassian/jira/bin/setenv.sh;
echo 'export JAVA_OPTS="-Dhttp.nonProxyHosts=<不需要代理的地址(e.g. localhost)> ${JAVA_OPTS}"' \
  >> /opt/atlassian/jira/bin/setenv.sh;

更改数据文件夹位置

编辑/opt/atlassian/jira/conf/server.xml,找到:

<Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">
  ....
</Context>

在内部插入如下参数标签:

<Parameter name="jira.home" value="文件夹路径(e.g. /mnt/jira/home)"/>>

给数据文件夹赋予Jira用户权限

chown -R jira:jira /mnt/jira/home

启动服务

service jira start

然后就可以打开网页继续配置了,网址就是这台服务器的ip,端口在安装时候有配置项,上面是8601 。
打开 http://服务器ip:8601

选择自行安装,按照Postgres配置填写完毕后下一步

这里一步需要一些时间,请耐心等待;下一步填写应用名称和服务地址。

最后进行破解注册:

回到命令行直接运行代理jar。(注意替换jira安装路径)

export JAVA_HOME="/opt/atlassian/jira/jre/"
java -jar /opt/atlassian-agent-v1.2.3/atlassian-agent.jar -m 邮箱 -o 注册昵称 -p jira -s <页面上的Server Id>

将命令行显示的激活码填回页面的文本框,下一步创建管理用户。

最后填写Smtp服务配置就完成所有配置流程了

Ok,开始搞事情!

 

 

 

本作品采用 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议 进行许可
标签: Jira
最后更新:2020年10月10日

Kenta

For More 🍗Drumsticks🍗

点赞

文章评论

取消回复

Kenta

For More 🍗Drumsticks🍗

分类目录
  • 各种库
  • 未分类
  • 软件们
书签
  • mc角色站 mc角色站
  • JiraTms JiraTms

© 2020 Kitagawa Kenta. All rights reserved.

THEME KRATOS MADE BY VTROIS

苏ICP备14034422号-4