Installing Apache Tomcat on Amazon EC2 without using RPM

bug tomcat java
Standard

How to install Apache Tomcat on Amazon EC2 instance without using a RPM.

Some readers have sent questions asking how to install Apache Tomcat without using a RPM. In this post, we go through quick steps to install Apache Tomcat on Amazon EC2 Instance. You should be done with the installation within 60 seconds of starting. Refer to the original post of Installing Java and Apache Tomcat on CentOS 6.5 on Amazon EC2 with RPM.

Requirements

  • Amazon EC2 instance (assumed available)
  • Java (assumed installed)

First we download Apache Tomcat binary. We are going to be using Apache Tomcat 7 for this installation.

Then explode the tar file

Now make the following directory for tomcat installation. You could also create a  /usr/tomcat/latest  and link to another folder. This way you upgrades can be managed easily. This is only a personal preference

Make sure that tomcat user owns the tomcat installation directory

Like Java, Tomcat requires an environment variable of its own to be set for it to run properly. Setup the variables in /etc/profile file

If you would like to run tomcat automatically on restarts or as a service (to control start and stop behaviour) you can do the following.

Personally, I also like to tail the logs after tomcat has been started. You can also put the following commands in a handy bash script to make it shorter to invoke them.

That’s it, you are done. Enjoy your newly installed Apache Tomcat.