Skip to main content

Setup Jenkins in Tomcat Webserver

Jenkins is a software that allows continuous integration. Jenkins will be installed on a server where the central build will take place.

System Requirements:
1. JDK
2. Tomcat


Java installation :
1. Download the latest JDK from Oracle's site

2. CentOS look for the package jdk-7u17-linux-x64.rpm (64-bit architecture) or jdk-7u17-linux-i586.rpm (32-bit architecture)

3. Once you download the installation package, use the command
rpm -ivh

4. Confirm you have the correct Java by running
java -version


Tomcat installation:
1. Download Apache Tomcat archive file from Apache Tomcat official download page. You can use below wget command to download it.
cd /tmpwget http://www.us.apache.org/dist/tomcat/tomcat-7/v7.0.54/bin/apache-tomcat-7.0.54.tar.gz

2. After competed download extract archive file in /tmp directory and move to proper location as per your need. We are placing this under /usr/local directory.
tar xzf apache-tomcat-7.0.54.tar.gz
mv apache-tomcat-7.0.54 /usr/local/tomcat7

3. Tomcat by default start on port 8080, Make sure no other services are running on same port using ‘telnet localhost 8080'
cd /usr/local/tomcat7
./bin/startup.sh

4. Now access the tomcat home page  at http://localhost:8080/

Increase the Tomcat Heap Memory:
1. Go to bin directory of tomcat server e.g.  /usr/local/tomcat7/bin

2. Create or edit the  setenv.sh file and add the following lines
export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms512m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m"

3. After saving the file, restart the tomcat.


Create Tomcat credentials for Manager:
1. Go to conf directory of tomcat server e.g.  /usr/local/tomcat7/conf

2. Edit the tomcat-users.xml file and add the following lines

<tomcat-users>
             <role rolename="manager"/>
             <role rolename="manager-gui"/>
             <role rolename="manager-script"/>
             <user username="admin" password="admin" roles="manager,manager-gui,manager-script"/>
</tomcat-users>

4. After that save the file and restart the tomcat.


Setup Jenkins:

1. Download the latest Jenkins war file from it official site .

2. Copy the jenkins.war in tomcat webapps directory e.g. /usr/local/tomcat7/webapps and restart tomcat.

3. Now you can access the Jenkin application using the URL

http://localhost:8080/jenkins/
 




Comments

Popular posts from this blog

Change Tomcat JSESSION Cookie Name and Path

Sometime we have a scenario that two different tomcat application running on same domain,  and you want to share a session cookie in between them, there are two problem will come in this scenario i.e: 1. Session Cookie Name : As both the application have same cookie name i.e JSESSIONID , so its difficult to know which JSESSIONID belongs to which application , so in this scenario we need to change the Session cookie name. 2. Cookie Path :  By default tomcat create a session cookie for the app context, due to which we can't share the cookies between two application , so we need to change the cookie path from  context to the root. For doing the above point we can use  ServletContextListener or   web.xml file. 1. ServletContextListener import javax.servlet.SessionCookieConfig; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class MyTestListener implements ServletContextListener  {     public void contextInit

Deploy application at ROOT(/) context in Tomcat

Tomcat has its own application with the name "ROOT" that is runing in the main root (/) context path, So when ever you install new tomcat and try to accesss  http://localhost:8080/  then it will show you the default tomcat home page, If you want to deploy you application at  http://localhost:8080/  then there is two way to do this 1. ROOT.war : Create your application war file with the name ROOT.war and place it in the [TOMCAT_HOME]/webapps/ directory and restart tomcat services 2. Server.xml : If you can't change the war file name then in server.xml file there is one context tag  that is use to map your application on any context Remove the ROOT folder directory from [TOMCAT_HOME]/webapps/ Copy your application war file into the same directory , let suppose your application war file name is "app.war". Edit the server.xml file located at [TOMCAT_HOME]/conf/server.xml, and add the context tag < Context path = "/" docBase = "app&

Encode from JavaScript and Decode at Java.

if you have a senerio like you want to send encoded parameter values from your web page  and decode them  at server side then this blog may be help you. JavaScript: Before submit the form I am encoding all the value entered by user so that it can not be read by humanly, for encoding the values I have written a method named  encodeBase64 <script> function encodeBase64(input){         var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";         input = escape(input);         var output = "";         var chr1, chr2, chr3 = "";         var enc1, enc2, enc3, enc4 = "";         var i = 0;              do {             chr1 = input.charCodeAt(i++);             chr2 = input.charCodeAt(i++);             chr3 = input.charCodeAt(i++);                      enc1 = chr1 >> 2;             enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);             enc3 = ((chr2 & 15) << 2