Install & Configure JIRA on EC2 Amazon Linux

 

Install Fonts

Find a font and copy it to the EC2 tool instance

scp -pr -i webserver.pem bitstream-vera ec2-user@youhost:/tmp

JIRA will throw an exception if the Java installation does not include a font like the one in Amazon Linux

Install Fonts in the tool instance

cd /usr/share
sudo mkdir fonts
sudo mv /tmp/bitstream-vera fonts
sudo chown -R root.root fonts
cd fonts
sudo chmod 755 bitstream-vera
cd bitstream-vera
sudo chmod  644 *.ttf

sudo yum install fontconfig
sudo fc-cache bitstream-vera

Installation

  1. Login as ec2-user
  2. Download the Linux JIRA installation
    cd
    wget http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-enterprise-4.1.2-standalone.tar.gz
    

    Check out the latest stable version

  3. Extract the file to ec2-user home directory
    tar -zxvf atlassian-jira-enterprise-4.1.2-standalone.tar.gz
    
  4. Install Jira
    sudo mv atlassian-jira-enterprise-4.1.2-standalone /opt/jira-4.1.2-std
    
  5. Create Jira home
    sudo mkdir /data/jira
    sudo chown ec2-user.ec2-user /data/jira
    
  6. Change Jira home (Jira data directory)
    vi /opt/jira-4.1.2-std/atlassian-jira/WEB-INF/classes/jira-application.properties
    

    Set Jira Home

    jira-application.properties
    jira.home = /data/jira
    
  7. Change Confluence listening port
    vi /opt/jira-4.1.2-std/conf/server.xml
    
    1. Change the port 8005 to 7101
    2. Change the port 8080 to 7100
    3. Change the port 8443 to 7102
  8. Change security setting
    vi /opt/jira-4.1.2-std/atlassian-jira/WEB-INF/classes/jira-application.properties
    
    jira.paths.set.allowed=true
    

    This is needed for the proxy (Virtual Host in the next section) to work. Unfortunately, it exposes some critical security vulnerability. To address this:

  • Enforce a firewall rule to allow access by trusted host only OR
  • Do not execute this step and the Virtual Host. Use http://jira.yourdomain.com:7100 to access the JIRA system

Configure Virtual Host

  1. Edit the virtual host file
    sudo vi /etc/httpd/conf.d/vhosts.conf
    
  2. Add the virtual host configuration
    <VirtualHost *:80>
            ServerName jira.yourdomain.com
            ServerAlias jira.yourdomain.com
            ProxyPreserveHost On
            ProxyRequests Off
            ProxyPass / http://jira.yourdomain.com:7100/
            ProxyPassReverse / http://jira.yourdomain.com:7100/
            ProxyTimeout 60
    </VirtualHost>
    
  3. Restart Apache
    sudo service httpd restart
    

    Make sure port 7100 is open and accessible by the EC2 public IP

DB Configuration

  1. Edit /opt/jira-4.1.2-std/conf/server.xml for the JDBC information
             <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"
                        driverClassName="com.mysql.jdbc.Driver"
                        url="jdbc:mysql://localhost/jiradb?useUnicode=true&amp;characterEncoding=UTF8"
                        username="jirauser"
                        password="somesecret"
                        maxActive="20"
                        validationQuery="SELECT 1"
                      />
    
  2. Edit Transaction information in /opt/jira-4.1.2-std/atlassian-jira/WEB-INF/classes/entityengine.xml
      <datasource name="defaultDS" field-type-name="mysql"[ delete this, if it exists: schema-name="PUBLIC" ]
          helper-class="org.ofbiz.core.entity.GenericHelperDAO"
          check-on-start="true"
          use-foreign-keys="false"
          ...
    

Start

% cd /opt/jira-4.1.2-std/bin
% ./startup.sh

Stop

% cd /opt/jira-4.1.2-std/bin
% ./shutdown.sh

Trouble shoot

Check the log files in

% cd /opt/jira-4.1.2-std/logs

Machine Restart

If JIRA is not shutdown probably

  1. Stop JIRA in case it is still running
  2. Clean up the lock file
    % cd /data/jira
    % sudo rm .jira-home.lock
    
  3. Start JIRA

Access

Browser Access

http://jira.yourdomain.com/

Auto-start Jira

  1. sudo vi /etc/init.d/jira
    #!/bin/bash
    #
    # Startup script for Tomcat/Jira
    #
    # chkconfig: 345 84 16
    # description: Tomcat/Jira server
    # processname: jira
    
    #Necessary environment variables
    export CATALINA_HOME="/opt/jira-4.1.2-std"
    if [ ! -f $CATALINA_HOME/bin/catalina.sh ]
    then
    echo "Tomcat not available..."
    exit
    fi
    
    start() {
    echo -n -e '\E[0;0m'"\033[1;32mStarting Tomcat: \033[0m \n"
    su -l ec2-user -c $CATALINA_HOME/bin/startup.sh
    echo
    touch /var/lock/subsys/jirad
    sleep 3
    }
    
    stop() {
    echo -n -e '\E[0;0m'"\033[1;31mShutting down Tomcat: \033[m \n"
    su -l ec2-user -c $CATALINA_HOME/bin/shutdown.sh
    rm -f /var/lock/subsys/jirad
    echo
    }
    
    status() {
    ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}' | wc | awk '{print $2}' > /tmp/tomcat_process_count.txt
    read line < /tmp/tomcat_process_count.txt
    if [ $line -gt 0 ]; then
    echo -n "jired ( pid "
    ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}'
    echo -n ") is running..."
    echo
    else
    echo "Tomcat is stopped"
    fi
    }
    
    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    restart)
    stop
    sleep 3
    start
    ;;
    status)
    status
    ;;
    *)
    echo "Usage: jirad {start|stop|restart|status}"
    exit 1
    esac
    
    

Add as a service

sudo chmod +x /etc/init.d/jira
sudo chkconfig --add jira
sudo chkconfig jira on

Start/stop JIRA

Use the following to start/stop JIRA once the JIRA service is configured

sudo service jira start
sudo service jira stop