Its been a long time since I posted a how to, but I had promised this one to a WHT member ( http://www.webhostingtalk.com/showthread.php?t=1248474 ) and I am setting this up for a client right now, so here goes –
We assume that you have Ubuntu 12.04 installed (64bit recommended).
First we update default packages –
Once this is complete, we install Oracle Java 7. As this has been excluded from Ubuntu’s repositories, we need to add a new repository using the add-apt-repository command. To use this command, we first install –
apt-get install python-software-properties
To install Oracle Java 7 –
apt-get install oracle-java7-installer
To make sure you have correctly installed it, run –
You should get the following (or similar) if everything has been installed –
Once Java is installed, let us install Tomcat 7. As Ubuntu 12.04 includes Tomcat 7 by default, no additional repository is required. Just run –
apt-get install tomcat7 tomcat7-admin tomcat7-common tomcat7-docs tomcat7-examples tomcat7-user
tomcat7-docs tomcat7-examples tomcat7-user tomcat7-admin are suggested packages but not necessary for installation / running of Tomcat 7.
After installation, Tomcat 7 will try to start but will fail due to following error –
* no JDK found – please set JAVA_HOME
invoke-rc.d: initscript tomcat7, action “start” failed.
This error tells us that JAVA_HOME is not set. To resolve this open the file
Add the following line and save the file. –
# The home directory of the Java development kit (JDK). You need at least
#JDK version 1.5. If JAVA_HOME is not set, some common directories for
# OpenJDK, the Sun JDK, and various J2SE 1.5 versions are tried.
Now you can try starting Tomcat using the following command –
service tomcat7 start
We use mod_jk to pass JSP requests to Tomcat and handle everything else using Apache. To install mod_jk
apt-get install libapache2-mod-jk
Now open the following file –
And this text –