Jira On premise – with Nginx



Requirements:

OS: Linux Server

CentOs 7https://www.centos.org/download/ 

  • Use the DVD ISO in order to make sure that everything is provided in the installation steps.

RedHat 7 – https://www.redhat.com/en

  • Either a paid subscription or a Developer subscription.

Jira (Confluence should work using the same steps. Have not tested this yet but will do.)

  • https://www.atlassian.com/software/jira/download

Note: Jira can be installed on either Windows, MacOS or Linux, but I would suggest installing this on a Linux server without a GUI so that the memory it uses is as small as possible.

For example, ReHel with Gnome will use about 1G-1.5 GB by default after installation. Adding Jira to the mix or anything else will make it even worse.

Step 1.

  • Install the OS.

I will be doing this on a RedHat Linux Server because I have a subscription for it, but you can follow the installation using CentOS 7, as it’s the free version of RedHat 7.

(Note that WM will detect RedHat or CentOS and try to use the Autoinstall. Make sure you uncheck the start VM after wizard is finished)

Uncheck to turn on VM upon finish.

Make sure to uncheck the option to Power on the VM after clicking Finish.

Click the “Edit virtual machine settings”

Before we start the VM let’s remove the AutoInstall disk so that we select ourselves what we want to install

  • Select the disc that says “Using file autoinst.iso”
  • Click Remove
  • Click OK

With that out of the way we are ready to install the installation.

First screen will be the selection of the Language. Select the option you like and select Continue.

  • At the installation summary we will need to do a few modifications, because this will let us add the stuff we need.

First of all, open the Software Selection.

By default, it will be set to Minimal Install.

 We will be changing this to “Basic Web Server”. This will provide us with the initial tools to set all up.

After that, on the right panel select the options I have, or add addons that you think you need, in case you want to extend the use of this VM.

1. Java Platform – Need even if Jira will install it.

2. PHP Support

3. Performance Tools – I add this strictly for the diagnostic tools (It’s Optional and not mandatory)

4. PostgreSQL Database Client

5. Web Servlet Engine

6. Compatibility Libraries – For libraries that are for older RedHat (or CentOS) versions

7. Development Tools

8. Security Tools

Once everything is select “Done” to be returned to the Software Selection screen. Wait a little for the software installation to be updated.

  • Now if you scroll down you will notice that the “Installation Destination” has a warning message. To resolve that simply click on it to bring you to the hardware selection and then click Done.

Note: In case the Hard Drive is not found, there is an Issue (at this time only saw it for RedHat 8 beta), where instead of the SCSI drive you will need to set a SATA one.

Important step: Open Network & Host Name

Select the internet and make sure you turn it ON!

If you miss that you will need to connect to the internet manually using the terminal and it might be a hassle if you have not done it before.

Change the Host name if you want and click Done.

Now we are ready to click “Begin installation”

While the installation is running we need to finish one last part here. The creation of a user account and a Root Password.

When I create my standard user that I will be login in with I like to make him an Admin account so make sure to check that option.

Once the installation is done a “Reboot” button will appear. Click it and wait for the system to reboot and take you into the system.

When the system reboots, you will notice two entries for the CentOS or RedHat. Select the first one, or simply wait 5 seconds and it will boot you automatically into the OS.

Step 2. Install Nginx

 With the OS install we are ready for the second part.

But first we need to login into the system.

If all went well, you should be welcomed by a black screen like the one bellow:

Enter your username and press Enter (or Return). The password box will not show anything while typing so make sure you enter it correctly and then once again press Enter.

If the password was entered correctly you will be seeing the username@hostname (location ~)

Perfect!

We can install what we need, but first let’s make sure the network is working. Do a quick ping to test this out.

Command: ping -c 4 www.goolge.com

If you get ping results that mean all went well and you have also set the network as on.

If not do the following:

  1. To check this, use “sudo nmcli d” command.
  2. If it is disconnected, use “sudo nmtui“->Edit a connection, select your network interface and choose “Automatically connect” option (by pressing Space key) and select OK.
  3. Do “sudo reboot now” After logging in, do “ping www.google.com“.

Configure Static IP

Using the above sudo nmtui command we can edit the connection and set a static IP

When terminal is open, type the following command: ip route | grep default

The result should be something like:

default via 192.168.40.2 dev ens38 proto dhcp metric 100

Open the bellow file and make sure change BOOTPROTO to static and add the lines like in the picture bellow making sure to add your IP.

$ cd /etc/sysconfig/network-scripts

$ ls

$ sudo nano ifcfg-<name>

We use the ls command to see the content of the folder and open the file of the connection we use. By default, it might be ifcfg-ens33 or something similar.

The gateway and DNS1 will be the result of ip route | grep default while the ip can be obtained with the hostname -I command.

Also, let’s add the 8.8.8.8 DNS entry to the config

$ sudo nano /etc/resolv.conf

Save and restart network

$ systemctl restart network

A quick ping to make sure all is still working

$ ping google.com

Configure Nginx repo for CentoOS 7

Run command:
$ sudo nano /etc/yum.repos.d/nginx.repo


Append following for CentOS 7.x:

[nginx]name=nginx repobaseurl=http://nginx.org/packages/mainline/centos/7/$basearch/gpgcheck=0enabled=1

To save press CTRL + X followed by typing Y, and press Enter twice. Once to confirm the save and second to confirm the name of the file

A note about configuring Nginx repo for RHEL 7

Create or edit file using vim/vi/joe text editor:
$ vi /etc/yum.repos.d/nginx.repo
Append following for RHEL (Red Hat Enterprise Linux) version 7.x:

[nginx]name=nginx repobaseurl=http://nginx.org/packages/mainline/rhel/7/$basearch/gpgcheck=0enabled=1

To save press CTRL + X followed by typing Y, and press Enter twice. Once to confirm the save and second to confirm the name of the file

Install Nginx on CentOS/RHEL

To install latest stable nginx server, run the following yum command:


$ sudo yum install nginx

When prompted type Y and press Enter

Start/stop/restart nginx server

First enable nginx service by running systemctl command so that it starts at server boot time:
$ sudo systemctl enable nginx

Start Nginx command

$ sudo systemctl start nginx

Stop Nginx command

$ sudo systemctl stop nginx

Restart Nginx command

$ sudo systemctl restart nginx

Find status of Nginx server command

$ sudo systemctl status nginx

Open port 80 and 443 firewall-cmd

You must open and enable port 80 and 443 using the firewall-cmd command:
$ sudo firewall-cmd --permanent --zone=public --add-service=http
$ sudo firewall-cmd --permanent --zone=public --add-service=https
$ sudo firewall-cmd --reload

Test it

Verify that port 8080 opened using ss command:
$ sudo ss -tulpn


Sample outputs:

Netid State      Recv-Q Send-Q         Local Address:Port                        Peer Address:Port              udp   UNCONN     0      0                          *:60139                                  *:*                   users:((“dhclient”,pid=242,fd=20))udp   UNCONN     0      0                          *:68                                     *:*                   users:((“dhclient”,pid=242,fd=6))udp   UNCONN     0      0                         :::34050                                 :::*                   users:((“dhclient”,pid=242,fd=21))tcp   LISTEN     0      128                        *:80                                     *:*                   users:((“nginx”,pid=696,fd=6),(“nginx”,pid=695,fd=6))

If you do not know your server IP address run the following ip command:

$ hostname -I
192.168.40.138

Changing the Host

We will need to add some data to the hosts data to proceed. This is because we will need to define the proxy address which will be in the form of a domain.


$ sudo nano /etc/hosts

Add the IP you obtained above using the hostname -I and your site (can be something made up but make sure it’s not in use already to create false positive issues later on.

It should look similar to the picture bellow

Now we are ready to install Jira on premise.

 

Step 3: Install Jira

First let’s change directory. For that run the bellow command:

 $ cd
/home/(username)/

Replace the username with yours. Once inside you can also do an mkdir download so that you place the downloaded file into that. If you done that do a cd download/ to move inside the folder

Once inside the folder we want to download Jira run the bellow command. It will download the latest version

$ wget https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-7.13.0-x64.bin

With the file downloaded we need to make the bin executable. For that we will be running the bellow command:

$ chmod a+x atlassian-jira-software-7.13.0-x64.bin

To now run the file, execute the command:

 $ sudo ./atlassian-jira-software-7.13.0-x64.bin

Follow the prompts to install Jira. You’ll be asked for the following info:
 

  • Install confirmation – type o and press Enter
  • Install type – choose option 1 (default settings). 
  • Destination directory – this is where Jira will be installed.
  • Home directory – this is where Jira data like logs, search indexes and files will be stored.
  • TCP ports – these are the HTTP connector port and control port Jira will run on. Stick with the default unless you’re running another application on the same port.
  • Install as service – this option is only available if you ran the installer as sudo. 
  • Install confirmation – type i and press Enter
  • Start Jira – type y and press Enter

Move to the conf directory inside of jira with the help of cd /opt/atlassian/jira/conf

To view the content of the folder run $ ls

We will need to update the Jira connector to point towards nginx and then make nginx look for the Jira.

To do so we will need to edit the server.xml file and uncomment the line highlighted bellow.

$ sudo nano /opt/atlassian/jira/conf/server.xml

Find the line with HTTP – Proxying Jira via Apache or Nginx over HTTP and remove the

<!—and –> that contains the Connector data.

Exist and save.

Create and set Nginx to search for the Jira configuration.

$ sudo nano /etc/nginx/conf.d/jira.conf

You will need to add the bellow data:

server {

    listen 80;

    server_name <hostname>;

    location /<context path if any> {

        proxy_pass http://127.0.0.1:8080;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-for $remote_addr;

port_in_redirect off;

proxy_redirect http://127.0.0.1:8080/ /;

proxy_connect_timeout 300;

    }

}

Save the file. Last step will be to restart the Jira service and the nginx service.

$ cd /opt/atlassian/jira/bin

$ sudo ./stop-jira.sh

Once that is complete start it up

$ sudo ./start-jira.sh

$ sudo systemctl restart nginx

If not error is returned that mean we have all system up and running. If you want to test that out run the bellow commands:

$ systemctl status nginx

$ systemctl status jira.service

We are done for now! Jira is up and ready for you to configure the connector.

Phase 2: Integrate Jira with Okta

Leave a Reply

Your email address will not be published. Required fields are marked *