How to set up Atlassian JIRA on Amazon EC2 in 15 minutes

Screen Shot 2015-03-12 at 20.50.19

This post will take you through setting up JIRA on an AWS Linux instance, as part of setting up Atlassian’s Continuous Integration toolset. There are 6 steps and the whole tutorial should take around 15 minutes to complete:

1. Setup LAMP on server;
2. Create and Configure MySQL;
3. Login to MySQL and setup JIRA DB;
4. Install JIRA;
5. Install MySQL Driver;
6. Configure JIRA using Wizard;

I was doing this out of interest and read individual articles, blogs and help pages, but was unable to find a single source to guide me through the full process. The below started off as a self-reference. I have tried to refine to be understandable, and have referenced articles I used that may be helpful if you have any further specific queries.

The only prerequisite is that you have an Amazon EC2 Instance is set up (see ‘Getting Started with Amazon EC2 Instances for Linux’).

I’m far from an AWS expert, so if you have any technical questions it is unlikely I can help, but please feel free to leave feedback. Thanks and enjoy!

1. Setup LAMP on server

First step is to perform some basic setup on your AWS instance. The section below will show you how to do this quickly, but I used this article – http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html – to guide me through this.

1.1 – Connect to your instance via Terminal or SSH application.

1.2 – Ensure your AWS server is fully updated with the latest patches and releases:

sudo yum update

1.3 – Install Apache, MySQL and PHP on your Amazon instance by running the following:

sudo yum groupinstall -y 'Web Server' 'MySQL Database' 'PHP Support'

1.4 – Next, install the php-mysql package:

sudo yum install -y php-mysql

1.5 – Start the Apache web server.

sudo service httpd start

1.6 – As a precaution, check if the Apache web server is running ok by running the following two commands:

sudo chkconfig httpd on
chkconfig -list httpd

1.7 – If everything looks OK, you can open a web browser and then navigate to the Elastic IP address associated with your Amazon Instance. Here, you should see an Apache test page – this confirms that LAMP has been setup OK.

Amazon Linux Test Page

 

2. Create and Configure MySQL

The second step is to configure MySQL – the underlying database that Stash will use to store settings and data. For more info see ‘Atlassian: Setting up a MySQL Database on Linux for JIRA’.

3.1 – Start the MySQL server:

sudo service mysqld start

3.2 – Execute the installation wizard for MySQL using the below command. When prompted, enter a password for the root account. Type ‘Y’ for all the options offered when prompted.

sudo mysql_secure_installation

3. Login to MySQL and setup JIRA DB

Now that MySQL is running, it is time to set up the database that JIRA needs, and also a user for JIRA so that it can access the database.

3.1 – Login to MySQL using terminal and your admin details created in step 3 above.

mysql -u root -p

3.2 – Create the JIRA DB

CREATE DATABASE jiradb CHARACTER SET utf8 COLLATE utf8_bin;

3.3 – Create the JIRA User with appropriate access rights

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on jiradb.* TO 'jirauser'@'localhost' IDENTIFIED BY 'password50';

3.4 – Refresh MySQL privileges then exit:

FLUSH PRIVILEGES;
exit;

3.5 – Validate that the database was setup correctly by logging back in:

mysql \--user=jirauser \--password=password50 \--database=jiradb

3.6 – User should be able to log in OK.

 

4. Install JIRA

The fourth step is to download and install JIRA on your AWS instance. Atlassian provide an installer file from their site that will do all the leg work.

4.1 – Download the JIRA installer direct to your AWS instance:

wget http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-6.1.5-x64.bin

4.2 – Create a jira folder:

mkdir jira

4.3 – Move installer to newly created JIRA folder:

mv atlassian-jira-6.1.5-x64.bin jira

4.4 – Move to jira folder ‘cd jira’ and use ‘ls’ to test that the file is in there OK

4.5 – Set run privileges on file, so you can install it:

chmod +x atlassian-jira-6.1.5-x64.bin

4.6 – Install the JIRA file by running:

./atlassian-jira-6.1.5-x64.bin

 

5. Install Atlassian MySQL Driver

If you want JIRA to use MySQL you need to download a Java/MySql connector (required for most Atlassian integrations to MySQL).

6.1 – Download the files to run the connector:

wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.34.tar.gz

6.2 – Unzip the file:

tar -zxvf mysql-connector-java-5.1.34.tar.gz

6.3 – Copy the connector .jar file from the unzipped folder into your JIRA ‘lib’ folder

cp mysql-connector-java-5.1.34/mysql-connector-java-5.1.34-bin.jar ../atlassian/jira/lib

6.4 – Restart JIRA:

atlassian/jira/bin/stop-jira.sh
atlassian/jira/bin/start-jira.sh

 

6. Configure JIRA using Wizard

JIRA has been setup and restarted, now the only thing that remains is to set it up using the JIRA wizard.

6.1 – JIRA is now up and running on your AWS. Open a web browser and navigation to http://<your AWS Elastic IP Address>:8080.

6.2 – You should see a JIRA first-time setup page.

6.3 – Specify that you want to define the database connect to (should be radio button), then attempt to connect to the MySQL DB using credentials setup earlier in Section 3. I used ‘localhost’ in hostname field to do this.

6.4 – Once you have filled all fields, click on ‘Test Connection’ to see if JIRA can connect and login to the ‘jiradb’ setup above.

6.5 – If ‘Test Connection’ works, then click ‘Next’ and follow the rest of the setup wizard. At the end you will have created an admin user for JIRA, and completed the setup. After that it is good to be used at http://<your AWS Elastic IP Address>:8080. Note: you will have to create an atlassian ID and either use an evaluation license, or buy one, as part of the rest of this wizard.

6.6 – If you receive an error on the first page, then welcome to my world for the first 15 times I tried it! It took me a while to figure it out, but here are the issues that I hit and what the resolution was to them.

 

Potential issues you may encounter…

  • If you cannot connect to JIRA instance in web browser…
    • Check that your AWS Security Group is configured to allow your machines’ IP address to access port 8080 on your elastic IP.
  • If JIRA crashes early on or mid-way through setup…
    • You may be hitting the limit of your AWS instance’s memory. I found that the micro tier EC2 instance (instance type: ‘t1.micro’) didn’t work for me, so I had to repeat all the above steps on a larger, paid for, AWS Linux instance (I used instance type: ‘c3.large’);
  • If having a problem when clicking ‘Test Connection’…
    • Check the host name you are using in point 6.3. If you are not using ‘localhost’, check that the IP address you are using is in your AWS Instance’s Security Group. You will need to ensure that you AWS instance allows inbound calls to port 3306.
    • Check that the JIRA connector driver is in the correct folder.
    • If you get a MySQL user access error that stops you from connecting, try creating a new user with admin rights as per this link – http://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server.

You may also like...

28 Responses

  1. Suranga says:

    Nice work Morris. This helps me not only to setup on Amazon EC2 but also for other servers too. Cheers and keep up the good work.

  2. Mitul says:

    Thanks for the useful note.

  3. Szymon Przedwojski says:

    Thanks so much! This tutorial is brilliant, worked like a charm! 🙂

  4. Rob says:

    Hi There, Yep this is the exact problem im having it starts up, then watching top it runs at 100% cpu for about a minute then just dies 🙁 so yeah i think t1.micro is a no go. however, you suggested simply upgrading to a large, this is surely more an expensive endeavor then just subscribing to jira via their servers isn’t it?

    • admin says:

      Depends how far you want to go with customising JIRA I think. I’ve been looking at how to integrate JIRA with Stash, Confluence, Bamboo and other Atlassian products, as well as looking at backend integration using JIRA APIs.

      If I can set up one or two AWS instances to support all that, then I figure it will work out cheaper in the long run. As I don’t have any dev teams waiting on me as well, I have time to play around – if I need to set it up for a company / project though, and just needed something that worked quickly – OnDemand seems to be the best bet.

      Unfortunately it’s taken me a few months to reply, so maybe you’ve decided which option to take, but I looked up these links that might be useful if you want to compare options:

      Pricing – https://www.atlassian.com/software/jira/pricing/?tab=download
      Hosted vs On Demand – https://answers.atlassian.com/questions/196550/jira-vs-jira-on-demand

      Hope this helps!

  5. Italo Pessoa says:

    E receive this message

    JIRA Scheduler not started: JIRA not setup yet.
    and I can’t acess JIRA by Web Browser

    • admin says:

      What step were you on when this happened?

      Without a bit more info on how far you got I can’t help too much, but you could try to run these commands can be used to start / stop JIRA, but only if it has been installed:

      sudo service jira stop
      sudo service jira start

  6. martin ro says:

    thanks mate, that helped me a lot!

  7. William says:

    Thx alot!

    With your help and adding a swap: http://stackoverflow.com/questions/11788593/getting-jira-to-run-on-amazon-ec2-t1-micro-instance

    I managed to run JIRA on a EC2 t1.micro!
    Its not very fast, but not very slow either.

    * Happy

  8. TN says:

    Section 3.5 should read “mysql \–user=jirauser \–password=password50 \–database=jiradb”
    (the password was jirapass50 which is not matched with what is set in section 3.4)

  9. Gill Flynn says:

    Thanks for the useful post. Took me a bit more than 15 mins though 🙂 Works ok on EC2 t1.micro now (single user)

  10. David Andresky says:

    Thanks for the great post. Was very helpful. I did find though that when I stop and restart the instance that I was getting server errors for both Jira and Confluence. Adding the command ‘sudo chkconfig mysqld on’ resolved this issue (as well as restarting the service manually after every reboot).

  11. Thanks, very helpful!

    Aside from the password issue mentioned by TN above, the only snag I hit was that using the MySQL connector version you specified (5.1.34) gave a non-descript error message when trying to load the wizard web page. I replaced it with the latest version (5.1.39) and everything worked nicely. (This is with JIRA 7.2.1.)

  12. david says:

    Hi I tried this tutorial till config mysql I got stuck, when i try to start mysql server using command ‘sudo service mysqld start’ it returned error:
    Failed to start mysqld.service: Unit mysqld.service failed to load: No such file or directory, run ‘whereis mysql’ command I can find only two dir with mysql: /usr/lib64/mysql /usr/share/mysql, no mysqld found. I selected update redhat EC2 instance. Tried to create another instance still same error. run ‘yum list | grep mysql’ I can see php-mysql.x86_64 is in the list, any help will be appreciated thanks

    • dsmorris85 says:

      Hi David, sorry I haven’t been able to replicate the issue. I’ve just made a few minor updates to the article, but nothing specific to the mysql set up, which worked fine for me on a new instance when I ran through the tutorial again.

      Did you manage to get around it?

  13. I was looking for this Method for last four days. Thanks for sharing dude. Now let me share this.

  14. Sting says:

    What is the cost for running JIRA on AWS EC2 per month?

  15. Perfect Tutorial. Got everything working on the first attempt.

  16. Bill says:

    This tutorial claims EC2 micro instance can run JIRA but requires some customization:

    http://blog.iphoting.com/blog/2012/06/02/running-jira-on-amazon-aws-ec2-micro-instance/

  17. naveena says:

    Will I able to configure JIRA software product this way? Don’t we require licensing here? I have a server license and do not have data centre license. Will that be an issue? I am new to this and any help will be greatly appreciated.

    • dsmorris85 says:

      Hi Naveena,

      Yes you do require a server license (not sure what a data centre license does). You should be able to follow these steps to get JIRA up and running, and then enter the license key into the browser as part of the setup.

      Regards
      Dave

  18. Jason says:

    Thanks Dave for your input. After having tried many ways to get JIRA server on AWS, I’m trying your way for the last time. But, unfortunately, I got stuck at “6.3 – Copy the connector .jar file from the unzipped folder into your JIRA ‘lib’ folder”

    Can you elaborate on that point ? I’d much appreciate it!

    • dsmorris85 says:

      Hi Jason,

      Looking at the page, I can see that the formatting on point 6.3 was a bit off. I have fixed that now, so perhaps that was the problem.

      In summary, this section is about installing a connector for JIRA to MySQL DBs. The three steps are to download it to AWS, unzip it, and then move it into the ‘lib’ folder of Jira. Once you’ve done that, you need to restart JIRA so it boots up and finds the connector during startup (step 6.4) – hope that helps.

      Regards
      Dave

Leave a Reply

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


*

Seo wordpress plugin by www.seowizard.org.