Search This Blog

Lets go..




Manage your Inventory | Grow your restaurant business | Manage your Employee | Control your accounts

Thursday

How to install latest Apache Tomcat

Ubuntu ::
Download latest apache tomcat server apache-tomcat.tar.gz file from here:: https://tomcat.apache.org
Give permission to /opt/tomcat :: chmod 777 /opt/tomcat
Move this apache-tomcat.tar.gz to /opt/tomcat directory :: mv apache-tomcat.tar.gz /opt/tomcat
Unpack apache-tomcat.tar.gz :: tar xvzf apache-tomcat-8.0.28.tar.gz
Give proper permission ::
chmod 777 /opt/tomcat/apache-tomcat-8.0.28
chmod 777 /opt/tomcat/apache-tomcat-8.0.28/*
chmod 777 /opt/tomcat/apache-tomcat-8.0.28/conf/*
chmod 777 /opt/tomcat/apache-tomcat-8.0.28/logs/*

vim ~/.bashrc
Add  below two lines end of the file in ~/.bashrc
Press i to edit ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export CATALINA_HOME=/opt/tomcat/apache-tomcat-8.0.28
After adding above two line
Press Esc button then write :wq and press Enter button

Increase tomcat heap memory
Add JAVA_OPTS="-Xms128m -Xmx128m"
in apache-tomcat/bin/catalina.sh at 5th line

Test tomcat server has been installed successfully ::
How to start or stop tomcat server
$CATALINA_HOME/bin/startup.sh
$CATALINA_HOME/bin/shutdown.sh
Open a browser and type localhost:8080 in address bar and you will get a tomcat server page.


CentOS 6.7 ::

Download latest apache tomcat server apache-tomcat.tar.gz file from here https://tomcat.apache.org
Execute these commands ::
[root@db-tom]# mv apache-tomcat-8.0.28.tar.gz  /usr/share
[root@db-tom]# cd /usr/share
[root@db-tom share]# tar -xzf apache-tomcat-8.0.28.tar.gz
This will create the directory /usr/share/apache-tomcat-8.0.28
[root@db-tom share]# cd /etc/init.d
[root@db-tom init.d]# vim tomcat

Press i and copy and paste below script

#!/bin/bash
JAVA_HOME=/usr/java/jdk1.8.0_72
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat-8.0.28
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)   
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac    
exit 0

Press Esc and type :wq and again press Enter button
[root@db-tom init.d]# chmod 755 tomcat



Increase tomcat heap memory ::
Add JAVA_OPTS="-Xms128m -Xmx128m"
in apache-tomcat/bin/catalina.sh
at 5th line

Tomcat Service manipulation ::
[root@db-tom]# service tomcat start
[root@db-tom]# service tomcat stop
[root@db-tom]# service tomcat restart

Open a browser and type localhost:8080 in address bar and you will get a tomcat server page

1 comment:

Thanks for your opinion