Apache, Java and Tomcat are all installed by default in my copy of Solaris 10 x86, I assume this is the same for all versions of Solaris. I was dreading compiling Apache and Tomcat from source and was even considering installing the package from Blastwave.org. Luckily I googled a bit more and soon realised everything was installed by default, which is actually a bit obvious when you think about it.
Thanks to a random bug report page on opensolaris.org requesting an addition in documentation I got straight to the answer. I had to add an extra step in to add the required environment variables (which are now sitting in my “profile” file to be loaded each time). I’ve compressed the information a bit here but these are the steps I took to start Apache and Tomcat:
First add the two environment variables JAVA_HOME and CATALINA_BASE (for Tomcat) to your “/etc/profile” file or current session using usual “export” command:
Now you need to make sure the config files for both Apache and Tomcat exist with the right filenames. Luckily there are example config files included with both so you can just rename/copy these config files:
cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf
cp /var/apache/tomcat/conf/server.xml-example /var/apache/tomcat/conf/server.xml
Now you can start up Apache:
svcadm enable apache
Now make a symbolic link to point the Tomcat “conf” directory to the Apache Tomcat “conf” directory (just to make sure config files come from the right place):
ln -s /var/apache/tomcat/conf conf
Now last of all, start up the Tomcat server using the startup.sh script in the Tomcat “bin” directory:
Now you have both Apache and Tomcat running (on ports 80 and 8080 respectively). The home directory for Apache, where the html documents etc are stored, is located at “/var/apache2/htdocs/”. The home directory for Tomcat is at “/var/apache/tomcat/webapps/ROOT”.
Interestingly the test page for Tomcat at “http://localhost:8080″ states the environment variable as “$CATALINA_HOME” and not “$CATALINA_BASE” as I used. My Tomcat seems to be perfectly happy and I can run the sample applications so I guess you don’t need to worry about this.
If you have installed Oracle you can use Oracle’s own web application server (OC4J) at “http://localhost:1158″. There is a default page here with links to documentation etc. I’ll write more on using this once I figure out how to do dev work in Windows and push it to our Solaris installs.