How to install Jira Software on Centos7 with PostgreSQL

UPDATE –July-2018 Original instruction was installing postgresql-server-9.2. Atlassian has dropped support for v9.2 for newer versions. The post updated to install Postgresql-server v9.6 instead. If you have followed original post, and now want to update your database server to the latest, you can follow this post: How to upgrade Postgresql server to v9.6

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 Centos7 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 Centos7 in one place.

All the details and screenshots are correct for below:

OS: Centos 7.5
Jira Software: atlassian-jira-software-7.11.1-x64
Database: PostgreSQL-9.6

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 wget

Open firewall ports

Centos 7 now comes with firewalld pre-installed and activated in some templates by default. You need to open the needed ports to get 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=8080/tcp --permanent

Redirect Traffic to port 80 (optional)

If you want to redirect the traffic to port 80 for the ease of access follow the next commands, otherwise you can skip them.

It is not recommended for production servers that are open to public. For production servers you can follow my other post to serve on https here. How to enable ssl for Jira Software on Centos7

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) and not http://localjiraserver:8080.

Install database server

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.

The version  that Centos7 repository includes at the moment is v9.2. It not supported by Atlassian products any more. So will need to use community repository the get the latest version of v9.6.

sudo yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
sudo yum install postgresql96-server

After installing the packages, you need to initialise and configure it.

Initialise

sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb

Initializing database ... OK

Control service

sudo systemctl enable postgresql-9.6
sudo systemctl start postgresql-9.6

create and set-up database

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

postgres=# CREATE USER jiradbuser PASSWORD 'jiradbpassword';
postgres=# CREATE DATABASE jiradb WITH ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;
postgres=# GRANT ALL PRIVILEGES ON DATABASE jiradb to jiradbuser;
\q

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. You can consider other methods 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 -u postgres -i 
-bash-4.2$ vim /var/lib/pgsql/9.6/data/pg_hba.conf

Update the line beginning with host. 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

change it to:

host    all             all             127.0.0.1/32            md5

then restart the service.

Download and Install Jira

sudo mkdir /opt/atlassian
cd /opt/atlassian/
sudo wget https://downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-7.11.1-x64.bin
sudo chmod +x atlassian-jira-software-7.11.1-x64.bin

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

Unpacking JRE ...
Starting Installer ...
Jul 28, 2018 4:04:57 AM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Jul 28, 2018 4:04:57 AM java.util.prefs.FileSystemPreferences$2 run
INFO: Created system preferences directory in java.home.

This will install JIRA Software 7.11.1 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.11.1 is complete
Start JIRA Software 7.11.1 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.11.1 is complete
Your installation of JIRA Software 7.11.1 is now ready and can be accessed
via your browser.
JIRA Software 7.11.1 can be accessed at http://localhost:8080
Finishing installation ...

Now you are ready to start setting up your Jira server from the browser.

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.

10 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.

    1. hi there,
      you can not run jira on 80. it will need you to run Jira as root which is not recommended. If you want to access the jira on port 80 you can follow the instructions on the firewall settings section.

  4. This guide can apply and work 100% to install Jira Service Desk (atlassian-servicedesk-3.14.1-x64) on Centos 7.5. I tested & confirmed it work.

    Many thanks Saeed , you help many guys save time.

    Regards
    Duc

Leave a Reply

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