You are here

HOW-TO Install and Run JIRA in Ubuntu - v2.0

A few weeks ago I wrote another article explaining how to install and run Atlassian JIRA in Ubuntu. Well, I was not quite satisfied with the results, so I tried another approach and it seems to be working better now as my previous JIRA installation was extremely slow and crashed due to Out of Memory errors.

So here are the steps:
1. Install Java
First of all, of course, install Java in your Ubuntu server and test the installation:

dambrosio@Sepultura:~$ java -version
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing)

2. Create a JIRA user

dambrosio@Sepultura:~$ sudo /usr/sbin/useradd --create-home --home-dir /home/jira --shell /bin/bash -U jira

3. Install Jira Standalone
I started with Jira Standalone version because it has a bundled HSQLDB database and an embedded Tomcat server, so it is the fastest way to start with Jira. Later on, simply changing the database to, let's say, MySQL would be a great idea for production servers. Atlassian offers a simple step-by-step guide for installing Jira Standalone in Linux.
Note: I created a '/usr/local/jira' symbolic link that points to the folder with the files.
Another Note: I also created the '/var/local/jira' folder to contain jira data

4. Prepare a startup script for Jira
And here is the major difference from my previous article. I want Jira to be started whenever the system boots so I will need a script that runs every time the system starts. Use the script below, change the values to whatever your settings are, save it as '/etc/init.d/jira' and make it runnable:

dambrosio@Sepultura:~$ sudo chmod +x /etc/init.d/jira


And here is the (much shorter) script:

#!/bin/sh -e
# Example Atlassian Standalone init script
# modified by dambrosio
 
# Define some variables
# Name of app ( JIRA, Confluence, etc )
APP=JIRA
# Name of the user to run as
USER=jira
# Location of application's bin directory
BIN=/usr/local/jira/bin
# Location of Java JDK
export JAVA_HOME=/usr/lib/jvm/java-6-sun

case "$1" in
  # Start command
  start)
    echo "Starting $APP"
    sudo -u $USER -E "$BIN/startup.sh"
    ;;
  # Stop command
  stop)
    echo "Stopping $APP"
    sudo -u $USER -E "$BIN/shutdown.sh"
    echo "$APP stopped successfully"
    ;;
  *)
    echo "Usage: /etc/init.d/jira {start|stop}"
    exit 1
    ;;
esac

exit 0

5. Create the symlinks
You need to provide the synlinks in the rc startup folders, and you can use a wrapper to create those instead of creating manually each one of those links. In ubuntu the command to do this is 'update-rc.d'.

dambrosio@Sepultura:/etc/init.d$ sudo update-rc.d -f jira defaults
 Adding system startup for /etc/init.d/jira ...
   /etc/rc0.d/K20jira -> ../init.d/jira
   /etc/rc1.d/K20jira -> ../init.d/jira
   /etc/rc6.d/K20jira -> ../init.d/jira
   /etc/rc2.d/S20jira -> ../init.d/jira
   /etc/rc3.d/S20jira -> ../init.d/jira
   /etc/rc4.d/S20jira -> ../init.d/jira
   /etc/rc5.d/S20jira -> ../init.d/jira

6. Ensure Jira is started successfully
Run the command below and acess 'http://localhost:8080' and you should see your Jira page.
As a last test, reboot your system and check that Jira is started up too.

dambrosio@Sepultura:/etc/init.d$ ./jira start
Starting JIRA
Detecting JVM PermGen support...
PermGen switch is supported. Setting to 512m
If you encounter issues starting up JIRA Standalone Edition, please see the Troubleshooting guide at
http://confluence.atlassian.com/display/JIRA/Installation+Troubleshooting+Guide

Comments

Thanks for the article! In the init.d file, the line

sudo -u $USER -E "$BIN/shutdown.sh "

should be without the space:

sudo -u $USER -E "$BIN/shutdown.sh"

The extra space results in the error "sudo: ../bin/shutdown.sh : command not found" and can be tricky if not seen directly :-)

Vanderhoven Nick

Thanks Nick!
Just fixed it!

Thanks for the script!

When running sudo update-rc.d -f jira defaults
The following warning is displayed:

update-rc.d: warning: /etc/init.d/jira missing LSB information

You can get rid of this warning (if you get it) by adding the following to the script after the #!/bin/sh -e
line


### BEGIN INIT INFO
# Provides: scriptname
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO

- Matt