Apache Tomcat is a web container that allows you to serve Java Servlets and JSP (Java Server Pages) web applications.Before you install Apache Tomcat you will want to make sure that you have installed Java (openjdk).
You can check with the dpkg command
manivel@manivel-admin:~$ dpkg --list | grep openjdk
If that command has not given output, You need to install java
manivel@manivel-admin:~$ sudo apt-get install openjdk
Apache Tomcat Installation
You will download and extract Tomcat.manivel@manivel-admin:/opt$ sudo wget http://www.poolsaboveground.com/apache/tomcat/tomcat-7/v7.0.40/bin/apache-tomcat-7.0.40.tar.gz
manivel@manivel-admin:/opt$ sudo tar -zxf apache-tomcat-7.0.40.tar.gz
Create tomcat user and set home directory /opt/tomcat/
manivel@manivel-admin:/opt$ sudo useradd -d /opt/tomcat/ tomcat
Start the Tomcat service using following command
manivel@manivel-admin:/opt/tomcat$ cd bin/
manivel@manivel-admin:/opt/tomcat/bin$ ./startup.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
manivel@manivel-admin:/opt/tomcat/bin$
Start up script for Tomcat
manivel@manivel-admin:~$ sudo vim /etc/init.d/tomcat
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
case $1 in
start)
sh /opt/tomcat/bin/startup.sh
;;
stop)
sh /opt/tomcat/bin/shutdown.sh
;;
restart)
sh /opt/tomcat/bin/shutdown.sh
sh /opt/tomcat/bin/startup.sh
;;
esac
exit 0
: wq
You will need to make the script executable by running the chmod command
manivel@manivel-admin:~$ sudo chmod 755 /etc/init.d/tomcat
Now you can able to start the tomcat following command
manivel@manivel-admin:~$ sudo /etc/init.d/tomcat start
sudo: unable toresolve host manivel-admin
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/java-6-openjdk
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
manivel@manivel-admin:~$
I hope it will help you....
No comments:
Post a Comment