Installing Tomcat on Red Hat Enterprise Linux 5

Posted on Mar 6, 2010

Last week I got an account with Rackspace Cloud and decided to try my hand at an enterprise Linux solution. I’ve worked with Red Hat EL before, but really had to be careful because if I broke the server, 200 clients would not be happy. The nice thing about this as well is that I could quickly spin up a test environment and do my testing before implementing it on a live server.

I wanted to run a tomcat server so I can start writing JSP and diploy a Java application over the web from my site. Could I have gone with a shared hosting account, sure. But what is the fun in that? I wanted to learn how to do the dirty work myself.

First things first. I had to install Java. So I went to Oracles site (formaly Sun Microsystems) and downloaded the latest JDK.

After installing the JDK, I had to install tomcat itself:



yum install tomcat5

I also installed the following package:

  • tomcat5-servlet
  • tomcat5-jasper
  • tomcat5-commn-lib
  • jakarta-commons-collections-tomcat5
  • tomcat5-jsp
  • tomcat5-server-lib
  • tomcat5-admin-webapps

On my cloud server I had to open up port 8080 in iptables. To do so:



/sbin/iptables -I INPUT -p tcp --dpart 8080 -j ACCECPT

The configuration for tomcat which includes the following can be found at /etc/tomcat5/tomcat5.conf:

  • CATALINA_TMPDIR
  • JAVA_ENDORSED_DIRS
  • JAVA_OPTS
  • port in which tomcat is running on

Webapps are found in /var/lib/tomcat5/webapps

Make sure that tomcat starts when the server starts:



/sbin/service tomcat5 start

That’s it. Pretty simple, huh?