如何在CentOS 8/RHEL 8 Linux上安装Jira

时间:2020-02-23 14:30:44  来源:igfitidea点击:

JIRA是Atlassian开发的项目管理工具。它还用于与软件开发和其他项目相关的问题跟踪和错误跟踪。本指南将引导我们完成在CentOS 8/RHEL 8 Linux上的安装Jira。

安装Java

要运行Jira,需要在CentOS 8/RHEL 8计算机上安装Java。

通过检查Java版本来确认安装:

$java -version
openjdk version "11.0.5" 2019-10-15 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.5+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode, sharing)

安装MySQL 5.7数据库服务器

撰写本文时,Jira不适用于MySQL 8数据库服务器,请使用下面的指南安装MySQL 5.7.

安装MySQL 5.7数据库CentOS 8/RHEL 8

编辑MySQL 5.7配置服务器部分以添加以下行。

$sudo 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

重新启动mysqld服务:

sudo systemctl restart mysqld

安装数据库服务器后,以root用户身份登录并为Jira创建数据库和用户:

$mysql -u root -p
CREATE DATABASE jira CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER 'jira'@'localhost' IDENTIFIED BY 'theitroad@localhost%rd';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,ALTER,INDEX on jira.* TO 'jira'@'localhost' IDENTIFIED BY 'theitroad@localhost%rd';
FLUSH PRIVILEGES;
QUIT;

在CentOS 8/RHEL 8上下载并安装JIRA

我们已经安装了Java和数据库服务器,下一步是下载JIRAs二进制文件。在" Jira下载"页面上检查最新版本。

sudo yum -y install wget
wget https://product-downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-8.8.1-x64.bin -O atlassian-jira-software.bin

给出文件执行位:

chmod +x atlassian-jira-software.bin

现在启动安装程序:

sudo ./atlassian-jira-software.bin

按<Enter>键开始设置Jira。

Unpacking JRE ...
Starting Installer ...

This will install Jira Software 8.6.0 on your computer.
OK [o, Enter], Cancel [c]
Click Next to continue, or Cancel to exit Setup.

选择[1]以使用快速安装设置:

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]
1

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: 8080 
RMI Port: 8005 
Install as service: Yes

输入i键开始安装。

Install [i, Enter], Exit [e]
i
Extracting files ...
Please wait a few moments while Jira Software is configured.
Installation of Jira Software 8.6.0 is complete

接受以启动Jira服务。

Installation of Jira Software 8.6.0 is complete
Your installation of Jira Software 8.6.0 is now ready and can be accessed
via your browser.
Jira Software 8.6.0 can be accessed at http://localhost:8080
Finishing installation ...

安装Java MySQL连接器:

wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.18.zip
unzip mysql-connector-java-8.0.18.zip
sudo cp mysql-connector-java-8.0.18/mysql-connector-java-8.0.18.jar /opt/atlassian/jira/lib

重新启动Jira:

sudo /etc/init.d/jira stop
sudo /etc/init.d/jira start

在CentOS 8/RHEL 8上配置JIRA Nginx代理

安装Nginx Web服务器并启用该服务。

sudo yum -y install nginx
sudo systemctl enable --now nginx

配置HTTP连接器

编辑Jira服务器配置文件。

sudo vi /opt/atlassian/jira/conf/server.xml

找到以下代码段:

<Connector port="8080" relaxedPathChars="[]|" relaxedQueryChars="[]|{}^&#x5c;&#x60;&quot;&lt;&gt;"
                   maxThreads="150" minSpareThreads="25" connectionTimeout="20000" enableLookups="false"
                   maxHttpHeaderSize="8192" protocol="HTTP/1.1" useBodyEncodingForURI="true" redirectPort="8443"
                   acceptCount="100" disableUploadTimeout="true" bindOnInit="false" scheme="http"

并添加proxyNameproxyPort元素(用适当的属性替换它们),下面的另一个连接器用于解决绕过代理的问题:

proxyName="jira.theitroad.local" proxyPort="80"

还要添加这些新行以绕过代理。

<!-- Standard HTTP Connector -->
       <Connector port="8082" maxThreads="150" minSpareThreads="25" connectionTimeout="20000" enableLookups="false"
                  maxHttpHeaderSize="8192" protocol="HTTP/1.1" useBodyEncodingForURI="true"
                  redirectPort="8443" acceptCount="100" disableUploadTimeout="true"

不要忘记在配置中替换jira.theitroad.local。配置应如下所示:

重新启动Jira:

sudo /etc/init.d/jira stop
sudo /etc/init.d/jira start

配置Nginx

为Jira创建一个新的Nginx配置文件。

sudo vi /etc/nginx/conf.d/jira.conf

更新Nginx设置以使用以下服务器(如果Nginx位于其他服务器上,则将Fira的jira.theitroad.local替换为FQDN,并将localhost替换为服务器的主机名):

server {
    listen 80;
    server_name jira.theitroad.local;
    location/{
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://localhost:8080;
        client_max_body_size 10M;
    }
}

禁用Nginx并重新启动Jira和Nginx

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
sudo  /etc/init.d/jira stop
sudo  /etc/init.d/jira start
sudo systemctl restart nginx

确认两个服务的状态:

$systemctl status jira nginx
● jira.service
   Loaded: loaded (/etc/rc.d/init.d/jira; generated)
   Active: active (running) since Mon 2017-01-06 16:06:27 EAT; 22s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 6299 ExecStop=/etc/rc.d/init.d/jira stop (code=exited, status=0/SUCCESS)
  Process: 6393 ExecStart=/etc/rc.d/init.d/jira start (code=exited, status=0/SUCCESS)
    Tasks: 89 (limit: 11512)
   Memory: 357.4M
   CGroup: /system.slice/jira.service
           └─6430 /opt/atlassian/jira/jre//bin/java -Djava.util.logging.config.file=/opt/atlassian/jira/conf/logging.properties -Djava.util.logging.man>

Jan 06 16:06:27 centos8.novalocal jira[6393]:                `UOJ
Jan 06 16:06:27 centos8.novalocal jira[6393]: [1B blob data]
Jan 06 16:06:27 centos8.novalocal jira[6393]:       Atlassian Jira
Jan 06 16:06:27 centos8.novalocal jira[6393]:       Version : 8.6.0
Jan 06 16:06:27 centos8.novalocal jira[6393]: [19B blob data]
Jan 06 16:06:27 centos8.novalocal jira[6393]: If you encounter issues starting or stopping Jira, please see the Troubleshooting guide at https://docs.a>
Jan 06 16:06:27 centos8.novalocal jira[6393]: Server startup logs are located in /opt/atlassian/jira/logs/catalina.out
Jan 06 16:06:27 centos8.novalocal jira[6393]: Tomcat started.
Jan 06 16:06:27 centos8.novalocal runuser[6399]: pam_unix(runuser:session): session closed for user jira
Jan 06 16:06:27 centos8.novalocal systemd[1]: Started jira.service.

● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-01-06 16:06:43 EAT; 6s ago
  Process: 6540 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 6538 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 6537 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 6542 (nginx)
    Tasks: 2 (limit: 11512)
   Memory: 3.9M
   CGroup: /system.slice/nginx.service
           ├─6542 nginx: master process /usr/sbin/nginx
           └─6543 nginx: worker process

Jan 06 16:06:43 centos8.novalocal systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jan 06 16:06:43 centos8.novalocal nginx[6538]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Jan 06 16:06:43 centos8.novalocal nginx[6538]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Jan 06 16:06:43 centos8.novalocal systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Jan 06 16:06:43 centos8.novalocal systemd[1]: Started The nginx HTTP and reverse proxy server.

在防火墙中允许http端口:

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload

安装完成后,请在浏览器中访问jira.example.com以开始设置过程。

选择不适自行设置。

单击下一步,然后提供MySQL数据库凭据。对于类型,选择我自己的数据库

单击测试连接,然后将显示成功连接消息。

在接下来的页面中,填写应用程序标题,模式,JIRA许可证,管理员帐户,电子邮件通知。最后一页将要求我们选择默认语言。

访问Jira Admin仪表板以创建更多用户。