AWS User Data for installing Jira standalone automatically

By | May 3, 2020

Here is the script it used to install Jira in EC2.  It is fairly self explanatory but essentially it:

  1. Creates a Jira home directory
  2. Downloads Jira Software standalone
  3. Extracts Jira
  4. Runs apt-get update
  5. Installs Java
  6. Starts Jira

It also updates a log file to keep you up to date with what is going on because it is running in “headless” mode or all under the covers so to speak so you have no idea what is happening without the log files.

The process takes about 10 minutes + the 2 minutes to start up the EC2 instance so be patient. While you are waiting, go and add port 8080 to your security group. You should then be able to navigate to your instance IP with 8080 appended at the back to continue the Jira set up process.


#!/bin/bash
mkdir /home/ubuntu/jirahome
echo "`date -d "+10 hours"`: jirahome directory created. Now downloading Jira." >> /home/ubuntu/log.txt
wget -P /home/ubuntu https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-8.8.0.tar.gz
echo "`date -d "+10 hours"`: wget jira completed. Now extracting Jira." >> /home/ubuntu/log.txt
sudo tar xvf /home/ubuntu/atlassian-jira-software-8.8.0.tar.gz -C /home/ubuntu
echo "`date -d "+10 hours"`: Jira extraction completed. Now updating apt-get." >> /home/ubuntu/log.txt
sudo apt-get update
echo "`date -d "+10 hours"`: sudo apt-get completed. Now installing AdoptOpenJDK keys." >> /home/ubuntu/log.txt
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
echo "`date -d "+10 hours"`: AdoptOpenJDK keys added. Now adding AdoptOpenJDK to repo." >> /home/ubuntu/log.txt
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
echo "`date -d "+10 hours"`: AdoptOpenJDK repository added. Now installing Java" >> /home/ubuntu/log.txt
apt-get -y install adoptopenjdk-8-hotspot
echo "`date -d "+10 hours"`: AdoptOpenJDK installed. Running Java confirmation. " >> /home/ubuntu/log.txt
java -version 2>> /home/ubuntu/log.txt
echo "`date -d "+10 hours"`: Java version confirmed. Now removing and creating new jira-application properties and setting jirahome." >> /home/ubuntu/log.txt
rm /home/ubuntu/atlassian-jira-software-8.8.0-standalone/atlassian-jira/WEB-INF/classes/jira-application.properties
touch /home/ubuntu/atlassian-jira-software-8.8.0-standalone/atlassian-jira/WEB-INF/classes/jira-application.properties
echo "jira.home=/home/ubuntu/jirahome" >> /home/ubuntu/atlassian-jira-software-8.8.0-standalone/atlassian-jira/WEB-INF/classes/jira-application.properties
echo "`date -d "+10 hours"`: Jira home set. Starting Jira now" >> /home/ubuntu/log.txt
./home/ubuntu/atlassian-jira-software-8.8.0-standalone/bin/start-jira.sh
echo "`date -d "+10 hours"`: start-jira.sh executed" >> /home/ubuntu/log.txt

You should see a Jira access problem where Jira cannot find your home directory. I’ll show you how to fix this in the next blog.

Category: AWS

Leave a Reply

Your email address will not be published. Required fields are marked *