Hero Image

Jira 8 setup with nginx, let's encrypt and mysql under ubuntu 20.04

Start by installing nginx

apt install nginx-full

Nginx virtualhost setup

vi /etc/nginx/sites-available/yourowndomain

server {
                server_name     CHANGE_THIS_with_YOUROWNDOMAIN;
                client_max_body_size 50M;

                location / {
                proxy_pass http://127.0.0.1:8080;
                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_set_header    X-Real-IP $remote_addr;
                proxy_connect_timeout       600;
                proxy_send_timeout          600;
                proxy_read_timeout          600;
                send_timeout                600;
    }

Symlink

ln -s /etc/nginx/sites-available/yourowndomain /etc/nginx/sites-enabled/yourowndomain

Install certbot

apt install python3-certbot-nginx

Issue certificate

certbot --nginx -d changeme_some_domain

Restart nginx

service nginx restart

Install mysql-server

apt install mysql-server

Under mysqld section in my.cnf file add following

character_set_server=utf8mb4
innodb_default_row_format=DYNAMIC
innodb_large_prefix=ON
innodb_log_file_size=2G

PS! if you have sql_mode variable set with value NO_AUTO_VALUE_ON_ZERO then delete value NO_AUTO_VALUE_ON_ZERO

Restart mysql so changes will take effect

service mysql restart

Create mysql database

It is important to create database with collate utf8mb4_bin. Use mysql console (mysql -u root -p):

CREATE DATABASE jiraprod CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

Add user access to database:

GRANT ALL PRIVILEGES ON jiraprod.* To 'jiraprod'@'localhost' IDENTIFIED BY 'CHANGE_ME';
flush privileges;
exit;

Jira setup

cd /tmp; curl -O https://product-downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-8.22.6-x64.bin
chmod +x atlassian-jira-software-8.22.6-x64.bin
./atlassian-jira-software-8.22.6-x64.bin

Prompts:

- This will install Jira Software 8.22.6 on your computer.

OK [o, Enter], Cancel [c]

Type o and press enter

- Please choose one of the following:

Express Install (use default settings) [1], Custom Install (recommended for advanced users) [2], Upgrade an existing Jira installation [3, Enter]

Choose 2 and enter

- Select the folder where you would like Jira Software to be installed.
Where should Jira Software be installed?
[/opt/atlassian/jira]

Enter

- Select the folder where you would like Jira Software to be installed.
Where should Jira Software be installed?
[/opt/atlassian/jira]

Enter

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

Choose option 2 and enter

- HTTP Port Number
[8080]

- Control Port Number
[8005]

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

Choose yes (type y)

- Install [i, Enter], Exit [e

Type i

Setting up mysql connector

cd /tmp; curl -O https://downloads.mysql.com/archives/get/p/3/file/mysql-connector-java-5.1.48.zip

Extract zip

unzip mysql-connector-java-5.1.48.zip

Enter directory

cd mysql-connector-java-5.1.48/

Copy java mysql driver to atlassian lib

cp mysql-connector-java-5.1.48.jar /opt/atlassian/jira/lib/

Mysql connector permission

chown jira:jira /opt/atlassian/jira/lib/mysql-connector-java-5.1.48.jar 

Setup tomcat HTTPS

Backup config

cp /opt/atlassian/jira/conf/server.xml /var/backup/
cd /opt/atlassian/jira/conf/

Edit server.xml file

vi or nano and comment out this http block:

<!-- Relaxing chars because of JRASERVER-67974
        <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"/>
           -->

Uncomment this section: "HTTPS - Proxying Jira via Apache or Nginx over HTTPS"

        <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" secure="true" scheme="https"
                   proxyName="CHANGE_THIS_DOMAIN" proxyPort="443"/>

Restart jira

service jira restart

Open in web browser http://YOUR_IP:8080 and on first setup choose:

"I'll set it up myself*

On next window choose:

"My own database"

Choose database type "Mysql". On new window fill in required fields. After that click next. On new window choose Application title (you can change this later also).

Change Base Url to be https://YOUR_DOMAIN.com

Click next. Fill in your license key

Your done. Can now access Jira directly via url https://YOUR_DOMAIN.com

Other Related Posts:

Grafana and Zabbix 3.4 setup on ubuntu

Zabbix Install

Php installation

sudo apt update
sudo apt dist-upgrade
sudo apt install php7.0-xml php7.0-bcmath php7.0-mbstring

Add repository

Setup the repository.

wget http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb
sudo dpkg...

Read more

20th Jan 2019