1装jdk
jdk-6u3-linux-i586.bin
#chmod u+x jdk-6u3-linux-i586.bin
#./jdk-6u3-linux-i586.bin
ln -s /usr/local/jdk1.6.0_03 /usr/local/jdk
ln -s /usr/local/jdk1.6.0_03 /jre /usr/local/jre
#vi /etc/profile
加入以下几行
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export CATALINA_HOME=/usr/local/tomcat
保存退出。#source /etc/profile 很重要 刷新环境变量
java –version 查看jdk是否安装成功
2 httpd-2.2.6.tar.gz#cp httpd-2.2.6.tar.gz /usr/local
#cd /usr/local
#tar zxvf httpd-2.2.6.tar.gz
#cd httpd-2.2.6
#./configure –prefix=/usr/local/apache --enable-module=so
#make
#make install
启动Apache,并测试。
# cd /usr/local/apache/bin
# ./apachectl start
打开浏览器,并在地址栏中输入主机的IP地址
apache-tomcat-6.0.14.tar.gz
#tar zxvf apache-tomcat-6.0.14.tar.gz
#cp –r apache-tomcat-6.0.14 /usr/local/tomcat
#/usr/local/tomcat/bin/startup.sh
设置系统环境变量:
# vi /usr/local/tomcat/bin/startup.sh 和 vi /usr/local/tomcat/bin/shutdown.sh
在“#――――――――――――――――――“
下分别加
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
打开http://localhost:8080 验证tomcat可以启动
在etc/rc.d/rc.local文件末尾加入/usr/local/tomcat/bin/startup.sh
整和apache和tomcat
tomcat-connectors-1.2.25-src.tar.gz
#tar zxvf tomcat-connectors-1.2.25-src.tar.gz
进行编译配置。大家一定要注意这几个参数中前三个是很重要的,必要时可以去相应的目录看看相关的文件是否存在。
#cd tomcat-connectors-1.2.25-src/native
# ./ buildconf.sh
#./configure --with-apxs=/usr/local/apache/bin/apxs --with-tomcat=/usr/local/tomcat --with-java-home=/usr/java/jdk --with-jni
# make
# make install
#ll /usr/local/apache/modules/mod_jk.so
mod_jk.so生成成功了。3 tomcat apache 整合
编辑apache的配置文件:
#vi /usr/local/apache/conf/httpd.conf
在末尾添加以下几行
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /usr/local/apache/conf/workers.properties
# Where to put jk logs
JkLogFile /usr/local/apache/logs/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] "
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# Send servlet for context /examples to worker named worker1
#JkMount /examples/*.jsp worker1
JkMount /servlet/* worker1
# Send JSPs for context /examples to worker named worker1
JkMount /*.jsp worker1
创建文件workers.proferties
#vi /usr/local/apache/conf/workers.porperties
添加如下内容:
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/jdk
ps=/
worker.list=worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.connection_pool_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.lbfactor=1
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
#vi /usr/local/tomcat/conf/server.xml 在<Host name=………xmlNamespaceAware=”false”>下加
<Context path=”” docBase=“/var/www/html” debug=”0” />
最后重新启动tomcat和apache,我们的安装就完成了
#/usr/local/tomcat/bin/shutdown.sh //关闭tomcat
#/usr/local/tomcat/bin/startup.sh //启动tomcat
#/usr/local/apache/bin/apachectl restart //重启apache
在主目录/var/www/html下vi test.jsp
Hello! The time is <%= new java.util.Date() %>