Documentation for JIRA 6.3 EAP developer (EAP) releases only. Not using this? See below:
(JIRA 6.2.x documentation | JIRA OnDemand documentation | earlier versions of JIRA)

Skip to end of metadata
Go to start of metadata
Icon

Linux/Solaris system administration is outside the scope of Atlassian support. This page is provided for your information only.

On Linux/Solaris, the best practice is to install, configure and run each service (including JIRA) as a dedicated user with only the permissions they require.

To install, configure and get JIRA to start automatically on Linux/Solaris:

  1. Create a jira user account which will be used to run JIRA. For example, enter the following at a Linux/Solaris console:

    sudo useradd --create-home -c "JIRA role account" jira
  2. Create a directory into which JIRA will be installed. For example:

    sudo mkdir /opt/atlassian/jira
    sudo chown jira: /opt/atlassian/jira
    
  3. Log in as the jira user to install JIRA:

    sudo su - jira
    
  4. Assuming you downloaded the JIRA from a 'tar.gz' archive, you need to extract it:

    cd /opt/atlassian/jira
    tar zxvf /tmp/atlassian-jira-X.Y.tar.gz
    ln -s atlassian-jira-X.Y/ current
    
  5. Edit current/atlassian-jira/WEB-INF/classes/jira-application.properties and set jira.home=/var/atlassian/application-data/jira
  6. Then back as root, create the file /etc/init.d/jira (code shown below), which will be responsible for starting up JIRA after a reboot (or when manually invoked).

  7. Make the init script executable:

    chmod \+x /etc/init.d/jira
  8. Place symlinks in the run-level directories to start and stop this script automatically.

    1. For Debian-based systems:

      update-rc.d jira defaults

      The following commands will be executed to place symlinks in the run-level directories:

      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
      
    2. For RedHat-based systems:

      Icon

      the init.d script contains chkconfig settings

      sudo /sbin/chkconfig --add jira
  9. Ensure the script is executed in the correct order, in particular after the database startup script.

Thank you for this information

Icon

Thank you to Matthew Block and Pete Toscano for the original comments that we based this information on.

18 Comments

  1. Found some typos:

    In start)

    BF: /bin/su -m $USER -c "cd $BASE/logs && $BIN/bin/startup.sh &> /dev/null"

    AF: /bin/su -m $USER -c "cd $BASE/logs && $BASE/bin/startup.sh &> /dev/null"

    In stop)

    BF: /bin/su -m $USER -c "$BASE/shutdown.sh &> /dev/null"

    AF: /bin/su -m $USER -c "$BASE/bin/shutdown.sh &> /dev/null"

    1. After doing the setup on my box I'd like to add some precision:

      to get the script LSB-conform on a debian system you should replace the header:

      Before:

      After:

      This info is in case you have a MySQL db running with JIRA. the important point is that the machine should start mysql before JIRA.

      Afterwards the command

      works fine :-)

      PS Please correct me if I'm wrong ;) I'm not entirely sure whether all the mentioned services are required...

      PPS Here's some more info on LSB and init scripts: http://wiki.debian.org/LSBInitScripts/

  2. Recent versions of Ubuntu are using upstart in place of the older System-V init.

    Here is my /etc/init/jira.conf in case you're interested:

    Note that I use upstart dependencies to ensure that Crowd is started first; see here.

  3. I've cobbled together an opensolaris smf manifest.
    It works for me.
    Whether its stable/suitable is another question.
    I dont know what I was doing when building it but it is working so far.

    jira.smf
    1. A Solaris SMF manifest often needs to be fine tuned: in this case, for example, you're relying on two dependencies that are not part of a Solaris 10 standard installation such as MySQL (from the manifest, I infer that you installed it from Blastwave or OpenCSW) and the service called "jira-unlock" that you don't specify further.

      I blogged about it: in this post you'll find a SMF with a dependency with a Solaris-bundled PostgreSQL instance. The post might be useful if you wanted to understand the basics of SMF and writing a manifest of your own.

  4. I've adapted the /etc/init.d/jira script to work on a Gentoo Linux distribution. Create the script with following content:

    #!/sbin/runscript
    # Copyright 1999-2011 Gentoo Foundation
    # Distributed under the terms of the GNU General Public License v2
    # $Header: $
    
    # 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
    BASE=/usr/local/jira/current
    # Location of Java JDK
    export JAVA_HOME=/etc/java-config-2/current-system-vm
    
    depend() {
        need net
    }
    
    start() {
        ebegin "Starting ${APP}"
    
        /bin/su -m ${USER} -c "cd ${BASE}/logs && ${BASE}/bin/startup.sh &> /dev/null"
    
        eend $?
    }
    
    stop() {
        ebegin "Stopping ${APP}"
    
        /bin/su -m ${USER} -c "${BASE}/bin/shutdown.sh &> /dev/null"
        
        eend $?
    }
    
    

    After create the file, execute the following command:

     rc-update add jira default
    
  5. Debian-based systems (among others) use the LSB system for init scripts. Below are the LSB headers for jira:

  6. Anonymous

    thanks worked fine for me.

  7. Anonymous

    With the latest releases (4.4.x) should this now be using start-jira.sh/stop-jira.sh rather than startup.sh/shutdown.sh?  Should there be any other changes?

  8. Anonymous

    I was having trouble getting the startup script above to work after manually upgrading to 5.0 from 4.2.1. The script at the top of the page worked for me before...

    I noticed that a very simple script ships with the 5.0 bin installer. The script below worked for me on Centos Linux.

     

    #!/bin/bash
     
    # JIRA Linux service controller script
    cd "/usr/local/atlassian-jira-5.0-standalone/bin"
     
    case "$1" in
        start)
            ./start-jira.sh
            ;;
        stop)
            ./stop-jira.sh
            ;;
        *)
            echo "Usage: $0 {start|stop}"
            exit 1
            ;;
    esac

     

     

     

     

     

    1. Anonymous

      The init.d script that ships with JIRA 5.0.3 is missing the chkconfig settings.

      Adding them back in (from the original startup script) after line 1...

      # JIRA startup script
      #chkconfig: 2345 80 05
      #description: JIRA

      ...lets the chkconfig add command work again:

      sudo /sbin/chkconfig --add jira
  9. Our JIRA instance wasn't always going down within 5 seconds, so we added a "stop-wait" goal as follows:

    Restart with Stop-Wait

     

     

    1. Anonymous

      Thank you very much!!
      This is exactly what I was looking for.

  10. I felt like these were all missing something, namely a status method, a confident stop method, and a check to avoid duplicate processes on start.  This script will also work for jira, confluence, bamboo, etc with minimal var modifications.  Thanks to the others for ideas and script code, I think I've combined most of them.  This script is running on Ubuntu 12.04.  I see where it can be a little cleaner but it works for me so I'm moving on.

     

  11. On Unix and Linux systems, it is best practice to set the shell for service accounts to an invalid shell such as /dev/null or /sbin/nologin. If you do that, you need to tweak the "su" command to include a valid shell. Like this:

    /bin/su -s /bin/sh -m $USER -c "$BASE/bin/startup.sh &> /dev/null"

    Also, if you're running SELinux, you might have to use /sbin/runuser instead of /bin/su. You can handle that like this

    if [ -x "/sbin/runuser" ]; then
         SU="/sbin/runuser -s /bin/sh"
    else
         SU="/bin/su -s /bin/sh"
    fi

    Then the line  to start becomes 

    $SU -m $USER -c "$BASE/bin/startup.sh &> /dev/null"


  12. What is this line for? Why in /var/atlassian/application-data/jira?
    1. Edit current/atlassian-jira/WEB-INF/classes/jira-application.properties and setjira.home=/var/atlassian/application-data/jira
  13. This script worked fine for me with out any errors.(In centos 6.4)

    #!/bin/sh -e

    # JIRA startup script

    #chkconfig: 2345 80 05

    #description: JIRA

     

    # Define some variables

    # Name of app ( JIRA, Confluence, etc )

    APP=jira

    # Location of application's bin directory

    BASE=/opt/atlassian/jira

    # Location of Java JDK

     

    case "$1" in

      # Start command

      start)

        echo "Starting $APP"

        $BASE/bin/startup.sh &> /dev/null

        ;;

      # Stop command

      stop)

        echo "Stopping $APP"

        $BASE/bin/shutdown.sh &> /dev/null

        echo "$APP stopped successfully"

        ;;

       # Stop-Wait command

      stop-wait)

        echo "Stopping $APP, waiting for actual termination"

        COUNTER=1

        while [  $COUNTER -gt 0 ]; do

            $BASE/bin/shutdown.sh &> /dev/null

            sleep 1

            COUNTER=$(ps aux | grep "[c]atalina.base=$BASE" | wc -l)

            done

        echo "$APP stopped successfully"

        ;;

       # Restart command

       restart)

         $0 stop-wait

         $0 start   

         ;;

      *)

        echo "Usage: /etc/init.d/$APP {start|restart|stop}"

        exit 1

        ;;

    esac

    exit 0