Subject: Configure Tomcat to survive instance reboot
Author: Linux
In response to: Install Tomcat on AWS EC2 instance
Posted on: 10/12/2011 09:24:18 PM
Create a file "/etc/rc.d/init.d/tomcat" with the following content:
#!/bin/sh
# Tomcat init script for Linux.
#
# chkconfig: 2345 96 14
# description: The Apache Tomcat servlet/JSP container.
JAVA_HOME=/usr/java/jdk1.6.0_29
CATALINA_HOME=/env/tomcat/apache-tomcat-6.0.33
export JAVA_HOME CATALINA_HOME
exec $CATALINA_HOME/bin/catalina.sh $*
You may need to tweak JAVA_HOME and/or CATALINA_HOME, depending on exactly which versions of the Java SDK and Tomcat you installed. Next, execute these commands to set the proper permissions for your init script and enable Tomcat for auto-launch:
# chmod 755 /etc/rc.d/init.d/tomcat
# chkconfig --level 2345 tomcat on
Tomcat should now be automatically launched whenever your server restarts.
>
> On 10/12/2011 09:10:52 PM
Linux wrote:
Download and Install Tomcat
Go to download page: http://tomcat.apache.org/download-60.cgi. Look for "tar.gz" under "Binary Distributions/Core" and copy the link address.
# mkdir /env
# mkdir /env/tomcat
# cd /env/tomcat
# curl http://mirror.atlanticmetro.net/apache/tomcat/tomcat-6/v6.0.33/bin/
apache-tomcat-6.0.33.tar.gz > apache-tomcat-6.0.33.tar.gz
# tar zxvf apache-tomcat-6.0.33.tar.gz
# cd apache-tomcat-6.0.33
# bin/startup.sh
To verify the installation, load the root page from a web browser: http://INSTANCE_PUBLIC_DNS_NAME:8080/
Note:
Substitute the public DNS address of your instance, as shown on the EC2 dashboard.
Port 8080 must be set for the given security group.
JAVA_HOME must be correctly set.
References: