Tomcat installation
Tomcat
Installation
- download tar file from https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.42/bin/apache-tomcat-7.0.42.tar.gz
- extract to /usr/lib/ folder
- rename apache-tomcat-7.0.42 to tomcat
- In /etc/bash.bashrc setCATALINA_HOME=/usr/lib/tomcatPATH=$PATH:/usr/lib/tomcat/bin
To
start tomcat as service
- create a file in /etc/init.d/ name it tomcat
- add this lines in tomcat
#!/bin/bash
###
BEGIN INIT INFO
#
Provides: tomcat
#
Required-Start: $network
#
Required-Stop: $network
#
Default-Start: 2 3 4 5
#
Default-Stop: 0 1 6
#
Short-Description: Start/Stop Tomcat server
###
END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
start()
{
sh
/usr/lib/tomcat/bin/startup.sh
}
stop()
{
sh
/usr/lib/tomcat/bin/shutdown.sh
}
case
$1 in
start|stop)
$1;;
restart)
stop; start;;
*)
echo "Run as $0 <start|stop|restart>"; exit 1;;
esac
3.
Give permissions to
sudo chmod 755 /etc/init.d/tomcat
4. Add tomcat file update-rc.d
sudo update-rc.d tomcat defaults
5. N
ow can start tomcat as service
sudo
service tomcat start
Disable
autostart for a tomcat service
update-rc.d
tomcat disable
Note :-
If get JRE_HOME not found error then update java alternatives
Note :-
If get JRE_HOME not found error then update java alternatives
set java alternatives
- sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_71/bin/java" 1
- sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_71/bin/javac" 1
Comments
Post a Comment