I use Atlassian JIRA as a tool to control my software development process, registering issues, tasks and bugs and planning development cycles.
So now that I switched to Ubuntu as development platform, I need to setup JIRA on my new Linux machine. I wrote down the steps I followed to achieve this.
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. 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: Do not forget to create a 'jira' user to be used to run the server. I used a slightly different command from the one they suggest in their guide
Another Note: I created a '/usr/local/jira' symbolic link that points to the folder with the files.
Yet Another Note: I also created the '/var/local/jira' folder to contain jira data
dambrosio@Sepultura:~$ sudo /usr/sbin/useradd --create-home --home-dir /home/jira --shell /bin/bash -U jira
3. Prepare a startup script for Jira
Now, I want Jira to be started whenever the system boots. I found this guide that offers a script based on tomcat's startup scripts. I also changed it a little bit so I copied it down here.
Simply save the script as '/etc/init.d/jira' and make it runnable:
dambrosio@Sepultura:~$ sudo chmod +x /etc/init.d/jira
Here is the slightly (path to Catalina Home) changed script:
#!/bin/sh # # /etc/init.d/jira -- startup script for the Jira standalone server # Based on the startup script for Tomcat 6 servlet engine # # Written by Miquel van Smoorenburg. # Modified for Debian GNU/Linux by Ian Murdock . # Modified for Tomcat by Stefan Gybas . # Modified for Tomcat6 by Thierry Carrez . # Modified for Jira standalone by MCC and dambrosio # ### BEGIN INIT INFO # Provides: jira # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Should-Start: $named # Should-Stop: $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Jira. # Description: Start the Jira standalone server. ### END INIT INFO set -e PATH=/bin:/usr/bin:/sbin:/usr/sbin NAME=jira DESC="Jira Server" DAEMON=/usr/bin/jsvc CATALINA_HOME=/usr/local/$NAME DEFAULT=/etc/default/$NAME JVM_TMP=/tmp/jira-temp if [ `id -u` -ne 0 ]; then echo "You need root privileges to run this script" exit 1 fi # Make sure jira is started with system locale if [ -r /etc/default/locale ]; then . /etc/default/locale export LANG fi . /lib/lsb/init-functions . /etc/default/rcS # The following variables can be overwritten in $DEFAULT # Run Jira as this user ID JIRA_USER=jira # The first existing directory is used for JAVA_HOME (if JAVA_HOME is not # defined in $DEFAULT) JDK_DIRS="/usr/lib/jvm/java-6-sun /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-ibm" # Look for the right JVM to use for jdir in $JDK_DIRS; do if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then JAVA_HOME="$jdir" fi done export JAVA_HOME # Directory for per-instance configuration files and webapps CATALINA_BASE=$CATALINA_HOME # Use the Java security manager? (yes/no) JIRA_SECURITY=no # Default Java options # Set java.awt.headless=true if JAVA_OPTS is not set so the # Xalan XSL transformer can work without X11 display on JDK 1.4+ # It also looks like the default heap size of 64M is not enough for most cases # so the maximum heap size is set to 128M if [ -z "$JAVA_OPTS" ]; then JAVA_OPTS="-Djava.awt.headless=true -Xmx128M" fi # End of variables that can be overwritten in $DEFAULT # overwrite settings from default file if [ -f "$DEFAULT" ]; then . "$DEFAULT" fi if [ ! -f "$CATALINA_HOME/bin/bootstrap.jar" ]; then log_failure_msg "$NAME is not installed" exit 1 fi if [ ! -f "$DAEMON" ]; then log_failure_msg "missing $DAEMON" exit 1 fi POLICY_CACHE="$CATALINA_BASE/work/catalina.policy" JAVA_OPTS="$JAVA_OPTS -Djava.endorsed.dirs=$CATALINA_HOME/endorsed -Dcatalina.base=$CATALINA_BASE -Dcatalina.home=$CATALINA_HOME -Djava.io.tmpdir=$JVM_TMP" # Set the JSP compiler if set in the tomcat6.default file if [ -n "$JSP_COMPILER" ]; then JAVA_OPTS="$JAVA_OPTS -Dbuild.compiler=$JSP_COMPILER" fi if [ "$JIRA_SECURITY" = "yes" ]; then JAVA_OPTS="$JAVA_OPTS -Djava.security.manager -Djava.security.policy=$POLICY_CACHE" fi # Set juli LogManager if logging.properties is provided if [ -r "$CATALINA_BASE"/conf/logging.properties ]; then JAVA_OPTS="$JAVA_OPTS "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" "-Djava.util.logging.config.file="$CATALINA_BASE/conf/logging.properties" fi # Define other required variables CATALINA_PID="/var/run/$NAME.pid" BOOTSTRAP_CLASS=org.apache.catalina.startup.Bootstrap JSVC_CLASSPATH="/usr/share/java/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar" # Look for Java Secure Sockets Extension (JSSE) JARs if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then JSSE_HOME="${JAVA_HOME}/jre/" fi export JSSE_HOME case "$1" in start) if [ -z "$JAVA_HOME" ]; then log_failure_msg "no JDK found - please set JAVA_HOME" exit 1 fi if [ ! -d "$CATALINA_BASE/conf" ]; then log_failure_msg "invalid CATALINA_BASE: $CATALINA_BASE" exit 1 fi log_daemon_msg "Starting $DESC" "$NAME" if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \ --user $JIRA_USER --startas "$JAVA_HOME/bin/java" \ >/dev/null; then # Regenerate POLICY_CACHE file #umask 022 #echo "// AUTO-GENERATED FILE from /etc/tomcat6/policy.d/" \ # > "$POLICY_CACHE" #echo "" >> "$POLICY_CACHE" #cat $CATALINA_BASE/conf/policy.d/*.policy \ # >> "$POLICY_CACHE" # Remove / recreate JVM_TMP directory rm -rf "$JVM_TMP" mkdir "$JVM_TMP" || { log_failure_msg "could not create JVM temporary directory" exit 1 } chown $JIRA_USER "$JVM_TMP" cd "$JVM_TMP" $DAEMON -user "$JIRA_USER" -cp "$JSVC_CLASSPATH" \ -outfile SYSLOG -errfile SYSLOG \ -pidfile "$CATALINA_PID" $JAVA_OPTS "$BOOTSTRAP_CLASS" sleep 5 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \ --user $JIRA_USER --startas "$JAVA_HOME/bin/java" \ >/dev/null; then log_end_msg 1 else log_end_msg 0 fi else log_progress_msg "(already running)" log_end_msg 0 fi ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \ --user "$JIRA_USER" --startas "$JAVA_HOME/bin/java" \ >/dev/null; then log_progress_msg "(not running)" else $DAEMON -cp "$JSVC_CLASSPATH" -pidfile "$CATALINA_PID" \ -stop "$BOOTSTRAP_CLASS" fi rm -rf "$JVM_TMP" log_end_msg 0 ;; status) if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \ --user $JIRA_USER --startas "$JAVA_HOME/bin/java" \ >/dev/null; then if [ -f "$CATALINA_PID" ]; then log_success_msg "$DESC is not running, but pid file exists." exit 1 else log_success_msg "$DESC is not running." exit 3 fi else log_success_msg "$DESC is running with pid `cat $CATALINA_PID`" fi ;; restart|force-reload) if start-stop-daemon --test --stop --pidfile "$CATALINA_PID" \ --user $JIRA_USER --startas "$JAVA_HOME/bin/java" \ >/dev/null; then $0 stop sleep 1 fi $0 start ;; try-restart) if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \ --user $JIRA_USER --startas "$JAVA_HOME/bin/java" \ >/dev/null; then $0 start fi ;; *) log_success_msg "Usage: $0 {start|stop|restart|try-restart|force-reload|status}" exit 1 ;; esac exit 0
4. Make Sure you have the JSVC package
JSVC is a wrapper to launch Java Applications as daemons and it is not installed by default with Java but our script will need it. You will be sure that you need it if you get this (pretty obvious) error message when running the startup script: 'missing /usr/bin/jsvc'. So go ahead and install it.
dambrosio@Sepultura:~$ sudo apt-get install jsvc
5. 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:~$ sudo /etc/init.d/jira start * Starting Jira Server jira [ OK ]
Comments
Found an easier way to do this
... so I wrote another HOW-TO article
http://definenull.com/content/how-install-and-run-jira-ubuntu-v20