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)
wget http://mirrors.ibiblio.org/apache/tomcat/tomcat-8/v8.0.33/bin/apache-tomcat-8.0.33.tar.gz
- 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
Testing
To test that your tomcat install is working simply do :
$CATALINA_HOME/bin/startup.sh
EC2 security
You should be able to access your tomcat instance page by going to ;
http://my_public_ip_address:8080/
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
wget http://mirrors.jenkins-ci.org/war-rc/2.0/jenkins.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:
$CATALINA_HOME/bin/shutdown.sh
Ok now we have downloaded Jenkins lets copy it to /opt/tomcat/webapps
sudo mv jenkins.war $CATALINA_HOME/webapps
Restart your server
$CATALINA_HOME/bin/startup.sh
Now navigate to the following location to continue with the Jenkins install
http://my_public_ip_address:8080/jenkins
I will create another post for what is in regards to configuration of Jenkins .
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)
wget http://mirrors.ibiblio.org/apache/tomcat/tomcat-8/v8.0.33/bin/apache-tomcat-8.0.33.tar.gz
- 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
Testing
To test that your tomcat install is working simply do :
$CATALINA_HOME/bin/startup.sh
EC2 security
You should be able to access your tomcat instance page by going to ;
http://my_public_ip_address:8080/
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
wget http://mirrors.jenkins-ci.org/war-rc/2.0/jenkins.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:
$CATALINA_HOME/bin/shutdown.sh
Ok now we have downloaded Jenkins lets copy it to /opt/tomcat/webapps
sudo mv jenkins.war $CATALINA_HOME/webapps
Restart your server
$CATALINA_HOME/bin/startup.sh
Now navigate to the following location to continue with the Jenkins install
http://my_public_ip_address:8080/jenkins
I will create another post for what is in regards to configuration of Jenkins .
No comments:
Post a Comment