Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Sunday, January 1, 2012

Install Tomcat to Amazon EC2 instance

To install Tomcat, first we need to install a JDK. Steps to install JDK.
  1. Login to AWS EC2 instance with putty.
  2. sudo su
  3. Create a directory for Java installation. cd /usr/share, mkdir java, cd java.
  4. Download a JDK from Oracle.  wget http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.tar.gz 
  5. Install it. tar -xzf jdk-7u2-linux-i586.tar.gz
  6. Test it. /usr/share/java/ jdk1.7.0_02/bin/java -version.
Install Tomcat.
  1. Download Tomcat to /usr/share directory. wget http://www.trieuvan.com/apache/tomcat/tomcat-7/v7.0.23/bin/apache-tomcat-7.0.23.tar.gz
  2. Install Tomcat. tar -xzf apache-tomcat-7.0.23.tar.gz
  3. set JAVA_HOME $env in catalina.sh. cd /usr/share/apache-tomcat-7.0.23/bin,
    vi catalina.sh and add following line after the first line. JAVA_HOME=/usr/share/java-1.7.0/jdk1.7.0_02
  4. Start it. ./start.sh. Check log and fix errors if any.
Next I will talk about creating a startup/shutdown script.