Skip to main content

CI-CD_001 - Jenkins on Tomcat Installation

CI-CD_001-Jenkins-on-Tomcat

Tomcat installation

  • Verify the Java installation
    # java -version
  • Set the Java home and Path
    # echo "export JAVA_HOME=/usr/java/jdk1.8.0_91/" >> ~/.bashrc
    # echo "export JAVA_HOME=/usr/java/jdk1.8.0_91/" >> /etc/bashrc
    # echo "export PATH=$PATH:$JAVA_HOME/bin/" >> /etc/bashrc
    # echo "export PATH=$PATH:$JAVA_HOME/bin/" >> ~/.bashrc
  • Download tomcat application from the following site in tar.gz format
    https://tomcat.apache.org/download-70.cgi
  • Make a custom application directory and untar the tomcat application
    mkdir /u01
    cp -prv ~/Downloads/apache-tomcat-7.0.69.tar.gz /u01/
    cd /u01
    tar -xzvf apache-tomcat-7.0.69.tar.gz
  • Create a soft link for the unzipped directory as tomcat
    ln -s apache-tomcat-7.0.69 tomcat
  • Copy the jenkins.war file into webapps directory
    cp -prv `locate jenkins.war` /u01/tomcat/webapps/
  • Now clone the "Jenkins" repo from Linux-Library git account "vmsnivas" and copy the tomcat script from the scripts dir to /sbin
    mkdir /git
    cd /git
    git clone https://github.com/vmsnivas/jenkins.git
    cp -prv /git/jenkins/scripts/tomcat /sbin/
  • Now start the tomcat application
    tomcat start
NOTE : Here you'll face some problems as the default ports of Jenkins and Tomcat are the same (8080). So we'll change the Jenkins port to some other in my case i am using 18080. Also will change the hostname, users and roles in tomcat
  • To change the default port of Jenkins edit "/etc/sysconfig/jenkins"
    JENKINS_PORT="18080"
  • Now let us configure the Tomcat
    - Change the hostname from "localhost" to "dev1.linux-library.ll"
        <Engine name="Catalina" defaultHost="dev1.linux-lirary.ll">
        <Host name="dev1.linux-library.ll"  appBase="webapps"
  • Configure a user to manage the UI. Edit "/u01/tomcat/conf/tomcat-users.xml" and add the following above "" tag.
    <role rolename="manager-gui"/>
    <role rolename="tomcat"/>
    <user username="arjun" password="aDminTom" roles="tomcat,manager-gui"/>
  • Now you can be able to use Jenkins through Tomcat. All you need to do is to load the below url
    http://dev1.linux-library.ll:8080/jenkins/

Comments

Popular posts from this blog

Ansible Installation Steps Red Hat Enterprise Linux 7

Ansible is a simple IT automation engine that automates provisioning, configuration management, application deployment and many other IT needs.  Designed for multi-tier deployments, ansible models your IT infrastructure by describing how all of your systems interrelate, rather than just managing one system at a time. In this Article we are going to learn Ansible Installation Steps Red Hat Enterprise Linux 7 – RHEL 7. It uses no agents and no additional custom security infrastructure, so it’s easy to deploy – and most importantly, it uses a very simple language YAML that allow you to describe your automation jobs in a way that approaches plain English. Ansible Architecture Ansible works by connecting to your nodes and pushing out small programs, called “Ansible modules” to them. These programs are written to be resource models of the desired state of the system. Ansible then executes these modules using SSH Protocol, and removes them when finished. Your library of modul...

Troubleshooting Tomcat using Catalina log

Troubleshooting Tomcat using Catalina log We can get the  catalina  logs in  $CATALINA_HOME/logs Here we'll have a  catalina.out We can see some huge info in that log file. If we want to what exactly happens since the start of tomcat then we need to log that into a new file. By default we have log rotation enabled on this logs. For now let us stop tomcat and nullify the catalina.out file and then start tomcat to have some new info in the catalina.out # service tomcat stop # cd $CATALINA_HOME/logs # :> catalina.out (or) cat /dev/null > catalina.out # ll catalina.out -rw-r----- 1 root root 0 Feb 18 16:19 catalina.out # service tomcat start # ll catalina.out -rw-r----- 1 root root 17341 Feb 18 16:21 catalina.out We can see the log being written after the start of tomcat. Now we can notice the instance giving some information about the starting of tomcat, about the configuration for the startup, path of the servlet instance for which the log is re...

Customizing Java Virtual Machine

Customizing Java Virtual Machine Customizing the  catalina.sh CATALINA_OPTS CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS" By default the CATALINA_OPTS line will looks like above. Among which the JPDA_OPTS is used to provide the debug options for the catalina script. Now we need to edit this line and can add our custom options like the size of initial memory of JVM (min. size), the size of memory of the JVM (max. size) it can grow upto, garbage collection options, etc. Add the below at the end of the  CATALINA_OPTS  line -Xms128m -Xmx256m -Xms  means Extended Minimum Size which is the min / initial size of a JVM to start with -Xmx  means Extended Maximum Size which is the max size upto which a JVM can grow