NOTE: THIS IS A ROUGH DRAFT 1st ATTEMPT IF YOU FIND ERRORS PLEASE LET US KNOW
PLEASE FORGIVE THE BAD FORMATTING AND/OR TYPO'S! :)
CentOS, Smith, Apache, Tomcat, MySQL
Thankfully, most of the Tomcat configuration was documented very well on the smith project site. I have just made some slight changes, updated links, etc to those sections.
-
Install CentOS 5 as a virtual machine.
-
Choose Server-GUI as the installation type. No other options selected
-
-
Install MySQL server
-
(# indicates terminal as the root user)
-
# yum install mysql-server
-
start mysql server
-
# /etc/init.d/mysqld start
-
-
set the root database user password
-
# mysqladmin -u root password “password”
-
-
If you would like to use mysql-admin download mysql gui tools from mysql.com
-
Download the Connector/J from mysql.com, for now just extract the tar and leave it on your desktop
-
-
Apache Webserver
-
the CentOS installation (server-gui) should have installed httpd for you already, but just to make sure do
-
# yum list httpd
-
make sure httpd.ARCHTYPE says “installed”
-
if it isn't installed, # yum install httpd
-
-
-
install httpd-devl
-
# yum install httpd-devel
-
-
-
Install Java
-
Go to http://java.sun.com/javase/downloads/index.jsp and save the JDK bin to your desktop
-
# sh ./jdk-6u1-linux-i586-rpm.bin
-
-
Tomcat
-
download tomcat from tomcate.apache.org
-
# wget http://mirrors.isc.org/pub/apache/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20.tar.gz
-
move the tar.gz to the /opt directory
-
# mv apache-tomcat-5.5.20.tar.gz /opt
-
-
extract the file
-
# tar xvf apache-tomcat-5.5.20.tar.gz
-
-
move the extracted files to the /opt/tomcat5 directory (you will need to create it)
-
# mv /opt/apache-tomcat-5.5.20 /opt/tomcat5
-
-
Edit the catalina.sh file to denote the path to the newly installed JDK
-
# vim /opt/tomcat5/bin/catalina.sh
-
add the following info:
-
JAVA_HOME=/usr/java/jdk1.6.0_01
-
-
-
-
JRE_HOME=/usr/java/jdk1.6.0_01/jre
JAVA_OPTS="-server -Xms1024M -Xmx1024M -XX:PermSize=256m -XX:MaxPermSize=256m \
-Duser.language=de -Duser.country=CH -Dfile.encoding=UTF-8 \
-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl"
-
Apache – Tomcat connector
-
download the connector source:
-
# wget http://apache.org/dist/tomcat/tomcat-connectors/jk/source/tomcat-connectors-1.2.23-src.tar.gz
-
extract the tar.gz file
-
# tar xvf tomcat-connectors-1.2.23-src.tar.gz
-
-
cd into the native folder within the newly created folder
-
# cd tomcat-connectors-1.2.23-src/native
-
(within the native direcotry )
-
# ./configure – with-apxs=/usr/sbin/apxs
-
# make
-
# make install
-
-
-
Configuring mod_jk
-
open the httpd.conf file and add the following:
-
-
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /var/log/httpd/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
-
create a file called workers.properties under your /etc/httpd/conf directory (this directory may be located elsewhere depending on where you installed apache)
-
add the following to your workers.properties file: (ajp113 stands for Apache JServ Protocol version 1.3, and basically says we are using JK2 http://tomcat.apache.org/connectors-doc-archive/jk2/common/AJPv13.html)
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
-
open /opt/tomcat5/conf/server.xml and comment out the connectorPort 8080 ensure that the connectorport 8009 isn't commented out.
<!-- <Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" /> -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
-
Now, set up your virtual hosts in apache to include this JKMount /* worker1 like so:
<VirtualHost *:80>
ServerName localhost JKMount /* worker1 </VirtualHost>
-
And add a host to your /opt/tomcat5/conf/server.xml
(NOTE: the appBase “webapps” is the relative path from /opt/tomcat5. In this case, it is a directory directly beneath it. The docBase attribute is a relative path from appBase, in this case ROOT is a directory under webapps)
<Host name=”localhost” appBase=”webapps” unpackWARs=”true” autoDeploy=”true” xmlValidation=”true” xmlNamespaceAware=”false”> <Context path=”” docBase=”ROOT/” reloadable=”true” privileged=”true” antiResourceLocking=”false” anitJARLocking=”false”> </Context> </Host>
-
Start Apache and Tomcat.
-
# /usr/sbin/httpd -k start
-
# /opt/tomcat5/bin/startup.sh
-
You should now be able to hit http://localhost and see the Welcome to Smith hello world message. And you can access the admin section of this instance by going to http://localhost/IDE/admin.html You haven't established a password yet, so just click on the “Login” button.
-
-
MySQL connector
-
In order to connect Smith and MySQL, we need to supply the Smith instance with the MySQL connector we downloaded earlier.
-
cd into the folder for the mysql connector we extracted eariler.
-
# cd /home/aaron/Desktop/mysql-connector-java-5.0.6
-
# cp mysql-connector-java-5.0.6-bin.jar /opt/tomcat5/webapps/ROOT/WEB-INF/lib
-
restart tomcat
-
# /opt/tomcat5/bin/shutdown.sh
-
# /opt/tomcat5/bin/startdown.sh
-
-
-
Now, lets add a datasource (make sure mysql is running /etc/init.d/mysqld start)
-
Assuming there is a schema named 'Test'
-
Name = test
-
JDBC URL = jdbc:mysql://localhost:3306/test
-
JDBC Driver full class name = com.mysql.jdbc.Driver
-
Username = root
-
Password = password
-
check Keep DB connection during request
-
click on the 'Save Data Source' button
-
-
-
