Dear Sunil,

Please follow below steps :

Install Tomcat 8 on Ubuntu 14
Perform an update and add an user called tomcat

sudo apt-get update
sudo groupadd tomcat
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat

wget http://Paste the Link you can get from Apache Tomcat website (core, .tar.gz)

sudo mkdir /opt/tomcat
sudo tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1
cd /opt/tomcat
sudo chgrp -R tomcat conf
sudo chmod g+rwx conf
sudo chmod g+r conf/*
sudo chown -R tomcat work/ temp/ logs/

Create a file to start tomcat as a service

sudo vi /etc/init/tomcat.conf

A sample file is listed below 

description "Tomcat Server"

  start on runlevel [2345]
  stop on runlevel [!2345]
  respawn
  respawn limit 10 5

  setuid tomcat
  setgid tomcat

  env JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
  env CATALINA_HOME=/opt/tomcat

  env JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
  env CATALINA_OPTS="-Xms1024M -Xmx1024M -server -XX:+UseParallelGC"

  exec $CATALINA_HOME/bin/catalina.sh run

  # cleanup temp directory after stop
  post-stop script
    rm -rf $CATALINA_HOME/temp/*
  end script

*Save the tomcat.conf file

*Restart Tomcat8

sudo initctl reload-configuration
sudo initctl start tomcat

Now to Change the Port of tomcat to 8083 and add a user over there :

1) To change port
  * First stop Tomcat : cd /opt/tomcat/bin/
                                  : ./shutdown.sh

 * Open server.xml file : cd /opt/tomcat/conf/
                                    : sudo gedit server.xml
                                  
Screenshot 1 : 
image
                           
Screenshot 2 :
image
     

Adding Users in Tomcat8 :

cd /opt/tomcat/conf/

sudo gedit tomcat-users.xml

image

Add 2 users, Once is to open manager app of tomcat and the other user credentials are for deployment in Jenkins :

image
Till here you are all set with tomcat.

Now in Jenkins in last step this is the plugin you need to install, I think I did it still once check again in Manage plugins

image

Restart your Jenkins once again.

Now go to the post build step and click on Deploy war/ear to container

image


Let us know if you need help.

Please do provide your feedback from below options incase if you are satisfied with the response.





358195:41453