Friday, April 08, 2016

Installing Jenkins 2.0 on Unbuntu 14 running on Amazon Ec2

This post is really a common set of instructions to have a Jenkins War installed on a Amazon EC2 instance .

Note that another option would be to use docker but right now I want to do it from scratch first.

So the first requirement is obviously to have a Ubuntu instance running , in my case its on Amazon's awesome EC2 service.

Once you have launched your instance follow the following instructions:

Tomcat Install

- Download Tomcat 8.0.33 ( not that there might be a later version so change URL accordingly)


- Extract the tar.gz file in your /home/ubuntu directory

tar xvzf apache-tomcat-8.0.33.tar.gz

Now that this has been done move the tar.gz to /opt/tomcat ( create directory if not avalailable)

sudo mkdir /opt/tomcat
sudo mv apache-tomcat-8.0.33 /opt/tomcat

OpenJDK 7 install

JDK 7 is not available by default on the ubuntu EC2 image ( at least the one am using ) so you might want to installing using:

apt-get install openjdk-7-jdk

Check that it installed using

java -version

Environment Variables

Set your environment variables by doing

nano ~/.bashrc

Then appending the following at the end of the file ( Remember to change to actual location of your tomcat install )

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export CATALINA_HOME=/opt/tomcat/apache-tomcat-8.0.33

Execute the following command to take effect:
. ~/.bashrc


To test that your tomcat install is working simply do :


EC2 security

You should be able to access your tomcat instance page by going to ;


Note that you get your my_public_ip_adress from your EC2 Instances page on the Public IP column .

If you cannot access the URL try clicking on the Security Groups link on the Instances page against your instance .

Then add a TCP rule on the Inbound tab :

That should be it , not re-start or whatever required.

Note that if you do not have an elastic ip address assigned to your ubuntu EC2 instance each time you shutdown and restart the server the Public Ip address will change dynamically .

Jenkins Install

We are going to install the WAR for Jenkins 2  so simply download the WAR


However do note that you need to check what is the current war from the Jenkins 2.0 site , always use the latest version !

Shutdown your tomcat it is up:


Ok now we have downloaded Jenkins lets copy it to /opt/tomcat/webapps

sudo mv jenkins.war $CATALINA_HOME/webapps

Restart your server

Now navigate to the following location to continue with the Jenkins install


I will create another post for what is in regards to configuration of Jenkins .

No comments: