Documentation for JIRA 4.3. Documentation for other versions of JIRA is available too.

This is a step-by-step guide to getting JIRA running with PostgreSQL, on Ubuntu. The information should be helpful for other Linux distributions too.

Sun Java

Make sure that you have got Sun's Java Development Kit (JDK) installed. Ubuntu and Debian come with a GCJ variant which will not work. See Installing Java on Ubuntu or Debian.

Creating a jira system account

It's a good idea to create a dedicated user to run JIRA (as with all server software):

jturner:~$ sudo /usr/sbin/useradd --create-home --home-dir /usr/local/jira --shell /bin/bash jira

Set up a PostgreSQL user

PostgreSQL is very easy to set up on Ubuntu:

jturner:~$ sudo apt-get install postgresql-8.2 postgresql-client-8.2
Reading package lists... Done
Building dependency tree
....
 * Starting PostgreSQL 8.2 database server             [ OK ]

Now we create a jira PostgreSQL user for the jira user to connect as:

jturner:~$ sudo su - postgres
postgres:~$ createuser -P jira
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
CREATE ROLE

We can now connect as our jira user and create a database. It's a good idea to version your databases so upgrading is safer, so here I've added _312 (indicating JIRA 3.12) to the database name:

postgres:~$ logout
jturner:~$ sudo su - jira
jira:~$ createdb jira_312
CREATE DATABASE

Configuring JIRA Standalone

Download JIRA Standalone and unpack it:

jturner:~$ sudo su - jira
jira:~$ tar zxvf /home/jturner/Desktop/atlassian-jira-enterprise-3.12-standalone.tar.gz > /dev/null
jira:~$ ln -s atlassian-jira-enterprise-3.12-standalone/ jira-3.12
jira:~$ cd jira-3.12
jira:~/jira-3.12$

Now download the PostgreSQL JDBC driver from the website and place it in JIRA's common/lib directory.. As I installed PostgreSQL 8.2 and have JDK 1.6, I got the JDBC4 version:

jira:~/jira-3.12$ cd common/lib/
jira:~/jira-3.12/common/lib$ wget -q 'http://jdbc.postgresql.org/download/postgresql-8.2-507.jdbc4.jar'
jira:~/jira-3.12/common/lib$ ls -l postgresql-8.2-507.jdbc4.jar
rw-rr- 1 jira jira 457436 2007-12-02 19:42 postgresql-8.2-507.jdbc4.jar
jira:~/jira-3.12/common/lib$

We can now configure the JDBC datasource:

jira:~/jira-3.12/common/lib$ cd ../../conf
jira:~/jira-3.12/conf$ cp server.xml server.xml.orig
jira:~/jira-3.12/conf$ vi server.xml
jira:~/jira-3.12/conf$ diff -u server.xml.orig server.xml
--- server.xml.orig     2007-12-16 10:50:06.000000000 +1100
+++ server.xml  2007-12-16 10:51:03.000000000 +1100
@@ -11,12 +11,10 @@

         <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false">
           <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"
-            username="sa"
-            password=""
-            driverClassName="org.hsqldb.jdbcDriver"
-            url="jdbc:hsqldb:${catalina.home}/database/jiradb"
-            minEvictableIdleTimeMillis="4000"
-            timeBetweenEvictionRunsMillis="5000"
+            username="jira"
+            password="jira"
+            driverClassName="org.postgresql.Driver"
+            url="jdbc:postgresql://localhost/jira_312"
             maxActive="20" />

           <!-- NOTE: When a database server reboots or their is a network failure all the connections in the

Configure JIRA to know what type of database it's connecting to:

jira:~/jira-3.12/conf$ cd ../atlassian-jira/WEB-INF/classes/
jira:~/jira-3.12/atlassian-jira/WEB-INF/classes$ cp entityengine.xml entityengine.xml.orig
jira:~/jira-3.12/atlassian-jira/WEB-INF/classes$ vim entityengine.xml
jira:~/jira-3.12/atlassian-jira/WEB-INF/classes$ diff -u entityengine.xml.orig entityengine.xml
--- entityengine.xml.orig       2007-12-16 10:52:25.000000000 +1100
+++ entityengine.xml    2007-12-16 10:53:00.000000000 +1100
@@ -97,8 +97,8 @@

         PLEASE DO NOT set the use-foreign-key* values to "true" as JIRA does not currently support this.
      -->
-    <datasource name="defaultDS" field-type-name="hsql"
-      schema-name="PUBLIC"
+    <datasource name="defaultDS" field-type-name="postgres72"
+      schema-name="public"
       helper-class="org.ofbiz.core.entity.GenericHelperDAO"
       check-on-start="true"
       use-foreign-keys="false"
jira:~/jira-3.12/atlassian-jira/WEB-INF/classes$

Starting JIRA

Everything is now configured, and we can start JIRA.

jira:~/jira-3.12$ ./bin/startup.sh
If you encounter issues starting up JIRA Standalone Edition, please see the Troubleshooting guide at http://confluence.atlassian.com/display/JIRA/Installation+Troubleshooting+Guide
Using CATALINA_BASE:   /usr/local/jira/jira-3.12
Using CATALINA_HOME:   /usr/local/jira/jira-3.12
Using CATALINA_TMPDIR: /usr/local/jira/jira-3.12/temp
Using JRE_HOME:       /usr/lib/jvm/java-6-sun
jira:~/jira-3.12$

No JAVA_HOME?

If you get the error:

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program

You'll need to install the Sun JVM and set JAVA_HOME.

To see whether JIRA is starting properly, you should 'tail' the logs with:

jira:~/jira-3.12$ tail -f logs/catalina.out
2007-12-16 11:51:22,912 main [core.entity.jdbc.DatabaseUtil] Entity "Version" has no table in the database
2007-12-16 11:51:22,919 main [core.entity.jdbc.DatabaseUtil] Entity "VersionControl" has no table in the database
2007-12-16 11:51:22,923 main [core.entity.jdbc.DatabaseUtil] Entity "Workflow" has no table in the database
2007-12-16 11:51:22,931 main [core.entity.jdbc.DatabaseUtil] Entity "WorkflowScheme" has no table in the database
2007-12-16 11:51:22,936 main [core.entity.jdbc.DatabaseUtil] Entity "WorkflowSchemeEntity" has no table in the database
2007-12-16 11:51:22,943 main [core.entity.jdbc.DatabaseUtil] Entity "Worklog" has no table in the database
2007-12-16 11:51:25,653 main ERROR [jira.ext.fisheye.FishEyeConfigImpl] Invalid FishEye configuration: FishEye Url must be specified.
2007-12-16 11:51:25,667 main INFO [atlassian.jira.upgrade.ConsistencyCheckImpl] Starting JIRA, Version: 3.12-#298
2007-12-16 11:51:25,667 main INFO [atlassian.jira.upgrade.ConsistencyCheckImpl] Configured to use database: postgres72
2007-12-16 11:51:25,669 main INFO [atlassian.jira.upgrade.ConsistencyCheckImpl] Could not find Issue Cache Listener, adding.
2007-12-16 11:51:26,032 main INFO [atlassian.jira.upgrade.ConsistencyCheckImpl] Could not find Mail Listener, adding.
2007-12-16 11:51:26,038 main INFO [atlassian.jira.upgrade.ConsistencyCheckImpl] Could not find Mail Queue Service, adding.
2007-12-16 11:51:26,053 main INFO [atlassian.jira.upgrade.ConsistencyCheckImpl] Input Language has not been set.  Setting to 'English'
2007-12-16 11:51:26,071 main INFO [atlassian.jira.upgrade.ConsistencyCheckImpl]

****************************************************************************************************
JIRA 3.12 build: 298 started. You can now access JIRA through your web browser.
****************************************************************************************************

[Filter: profiling] Using parameter [jira_profile]
[Filter: profiling] defaulting to off [autostart=false]
[Filter: profiling] Turning filter off [jira_profile=off]
2007-12-16 11:51:26,487 main [webwork.dispatcher.ServletDispatcher] Unable to find 'webwork.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir
16/12/2007 11:51:26 org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
16/12/2007 11:51:26 org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
16/12/2007 11:51:26 org.apache.catalina.startup.Catalina start
INFO: Server startup in 5761 ms

The Entity "..." has no table in the database messages indicate that JIRA has found an empty database and is creating the necessary tables. Ie. the connection to PostgreSQL is working.

Congratulations, you have got JIRA installed. You can see it running at http://localhost:8080, where you can follow the setup wizard to complete the configuration.

  • No labels