How to install Jira Software on Centos7 with PostgreSQL

Up until now I always have used Mysql server for Jira instances. PostgreSQL is Atlassian preferred database for Jira and other products. So I will go through installing steps for this configuration. I already have a fresh minimal Centos 7 installation.

Atlassian has a guide for this but it is generic covering all possible combinations and for this specific installation one need to jump between various pages. This post will have all you need to know on how to install Atlassian Jira on Centos 7 in one place.

All the details and screenshots are correct for below:

OS: Centos 7 ( Linux 3.10.0-327.el7.x86_64)
Jira Software: atlassian-jira-software-7.2.3-x64
Database: PostgreSQL-9.2

Preparation

Before start, you need to decide where to download your resources. I usually have my resources in one place. Create a folder for it if you haven’t got one.

sudo yum update
sudo yum install vim wget
sudo mkdir /opt/atlassian
cd /opt/atlassian/

Download

sudo wget https://downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-7.2.3-x64.bin
sudo chmod +x atlassian-jira-software-7.2.3-x64.bin

Install

sudo ./atlassian-jira-software-7.2.3-x64.bin

Unpacking JRE ...
Starting Installer ...
Nov 01, 2016 10:49:13 AM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Nov 01, 2016 10:49:13 AM java.util.prefs.FileSystemPreferences$2 run
INFO: Created system preferences directory in java.home.

This will install JIRA Software 7.2.3 on your computer.
OK [o, Enter], Cancel [c]
o
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

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]

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
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
Install [i, Enter], Exit [e]
i
Extracting files ...
  atlassian-jira/secure/admin/views/filters/shared-filters.jsp

Please wait a few moments while JIRA Software is configured.
Installation of JIRA Software 7.2.3 is complete
Start JIRA Software 7.2.3 now?
Yes [y, Enter], No [n]
y

Please wait a few moments while JIRA Software starts up.
Launching JIRA Software ...
Installation of JIRA Software 7.2.3 is complete
Your installation of JIRA Software 7.2.3 is now ready and can be accessed
via your browser.
JIRA Software 7.2.3 can be accessed at http://localhost:8080
Finishing installation ...
[saeed@zohal atlassian]$


Open firewall ports

Centos 7 now comes with firewalld pre-installed and activated by default. You need to open the needed ports to be able to access to the server through web browser.

First check the active zones:

firewall-cmd --get-active-zones
public
  interfaces: eth0
then you can add the ports needed to the zones you want (public here)
sudo firewall-cmd --zone=public --add-port=8060/tcp --permanent

Jira is going to be the only web service on this machine. So to save typing in the port number each time, I use firewalld to redirect port 80 to 8080. So I just type in my server name and internally port 8080 is called. So instead of the above port you need to go through below lines:

sudo firewall-cmd --zone=public --add-masquerade --permanent
sudo firewall-cmd --zone=public --add-forward-port=port=80:proto=tcp:toport=8080 --permanent
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent

Remember to reload the firewall for changes to take effect.

sudo firewall-cmd --reload

Now if you have the correct DNS server set-up, to get to the Jira home page you just need to point to the server host name (http://localjiraserver) rather than http://localjiraserver:8080.

Install database engine and connector

Atlassian’s recommended database engine for Jira is PostgreSQL. It is also easiest option to install because it doesn’t need extra steps to download Java connector separately.

sudo yum install postgresql-server

Post-installation commands

After installing the packages, a database needs to be initialised and configured.

Data Directory

The PostgreSQL data directory has all the data files for the database. The variable PGDATA is used to reference this directory.

export PGDATA=/var/lib/pgsql/data

Initialise

The first command (only needed once) is to initialise the database in PGDATA.

sudo postgresql-setup initdb

Initializing database ... OK

Control service

To control the database service in RHEL 7.1+ and CentOS 7.1+, Systemd is introduced.

Use this to control the service

sudo systemctl enable postgresql
sudo systemctl start postgresql

create and set-up database

sudo -u postgres -i
-bash-4.2$ psql
psql (9.2.15)
Type "help" for help.

postgres=# CREATE USER jiradbuser PASSWORD 'jiradbpassword';
GRANT ALL ON SCHEMA public TO jiradbuser;
GRANT ALL ON ALL TABLES IN SCHEMA public TO jiradbuser;
CREATE DATABASE jiradb WITH ENCODING='UTF8' OWNER=jiradbuser CONNECTION LIMIT=-1;
\q

Initially i created a schema named jira and tried to use it to set-up the database. But every the set-up failed in various stages. After spending some time trying to fix it decided a dedicated schema probably not needed as this server will be a dedicated server anyway.

configure authentication methods

default authentication method for local connections in PostgreSQL is set to ‘ident’ that means it will get the operating system user name of the client by contacting the ident server on the client and check if it matches the requested database user name. You can read more on this on official PostgreSQL site.

As we are not planing to have a ident server this needs to be updated. I use md5 method. Other methods can be used too depending on the situation. All these settings resting in pg_hba.conf file in data folder of the postgresql installation.

so need to do below:

sudo vim /var/lib/pgsql/data/pg_hba.conf

just one line needs to be updated. It is towards the end of the file (line 82 in my case) the one starts with host.

this line:

host    all             all             127.0.0.1/32            ident

needs to be updated to:

host    all             all             127.0.0.1/32            md5

then restart the service.

Now all is set to start setting up your Jira server.

Set up Jira

Now open web browser and point to the address that you installed the server.

Select the language and PostgreSQL as external database.

1-jira-setup

 

2-db-setup

 

3-test-db-connection

4-setup-database

If you pass this stage then it is safe to say you almost done the set-up. there are four more steps specifying the application server title, administrator details, license details and email notification set-up which are self explanatory and can be deferred or easily changed later.

6 Comments

  1. I got an Error

    JIRA Startup Failed

    The following plugins are required by JIRA, but have not been started:
    Gadget Directory Plugin (com.atlassian.gadgets.directory)
    Atlassian JIRA – Plugins – Gadgets Plugin (com.atlassian.jira.gadgets)
    Atlassian JIRA – Plugins – Global Issue Navigator (com.atlassian.jira.jira-issue-nav-plugin)
    Atlassian JIRA – Plugins – Quick Edit Plugin (com.atlassian.jira.jira-quick-edit-plugin)
    Atlassian JIRA – Plugins – REST Plugin (com.atlassian.jira.rest)

    1. after i rebooted server it was working for a few minutes then it became blank page.
      I did rebooted server once last time:
      now i cannot access to my jira

      systemctl status jira
      ● jira.service – (null)
      Loaded: loaded (/etc/rc.d/init.d/jira)
      Active: active (exited) since Mon 2016-11-21 16:46:57 ICT; 8min ago
      Docs: man:systemd-sysv-generator(8)
      Process: 6078 ExecStop=/etc/rc.d/init.d/jira stop (code=exited, status=1/FAILURE)
      Process: 6111 ExecStart=/etc/rc.d/init.d/jira start (code=exited, status=0/SUCCESS)

      Nov 21 16:46:56 demo1 jira[6111]: .MMMMMM. .MMMMM~.
      Nov 21 16:46:56 demo1 jira[6111]: .MMMMMN .MMMMM?.
      Nov 21 16:46:56 demo1 jira[6111]: Atlassian JIRA
      Nov 21 16:46:56 demo1 jira[6111]: Version : 7.2.3
      Nov 21 16:46:56 demo1 jira[6111]: If you encounter issues starting or stopping JIRA, please see the Troubleshooting guide at http://co…ing+Guide
      Nov 21 16:46:56 demo1 jira[6111]: Server startup logs are located in /opt/atlassian/jira/logs/catalina.out
      Nov 21 16:46:57 demo1 jira[6111]: Existing PID file found during start.
      Nov 21 16:46:57 demo1 jira[6111]: Removing/clearing stale PID file.
      Nov 21 16:46:57 demo1 jira[6111]: Tomcat started.
      Nov 21 16:46:57 demo1 systemd[1]: Started (null).
      Hint: Some lines were ellipsized, use -l to show in full.

      1. did you upgrade from an older version or this was a fresh install? Sometimes plug-ins can cause headache when upgrading.
        However, I reckon you best fill in a support ticker with attlasian they are usually quick to respond.

  2. Thank you so much for this guide. It made my install process go so much quicker.

    One typo in the firewall section. “sudo firewall-cmd –zone=public –add-forward-port=port=80:proto=tcp:toport=8080 –permanentsudo firewall-cmd –zone=public –add-port=80/tcp –permanent”
    is on one line when it needs to be split at the second sudo.

  3. Hi Saeed!! Thank you for the above tutorial. How do we change the port to 80 ? I tried changing server.xml from 8080 to 80 and restarted Jira, unable to access the jira after making the changes.

    Any help would be appreciated.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.