一、安装环境
1、硬件环境:
CPU: P4 2.8
memory:512M
2、软件环境:
OS: ubuntu 5.10
compiler: gcc 3.4.4
perl 5.8.7
make 3.81
二、所需软件
httpd-2.2.0.tar.gz
j2sdk-1.4.2-02
jakarta-tomcat-5.0.30.tar.gz
jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
三、安装软件
1、apache 安装
tar xvzf httpd-2.2.0.tar.gz
cd httpd-2.2.0
./configure --prefix=/opt/apache2 --enable-mods\
--shared=all --enable-module=so --enable-cache=shared\
--enable-proxy=shared --enable-proxy_http=shared \
--enable-suexec --with-suexec-caller=www
make
make install
2、j2sdk 安装
chmod 755 j2sdk-1_4_1_07-linux-i586-rpm.bin
./j2sdk-1_4_1_07-linux-i586-rpm.bin
rpm -ivh j2sdk-1_4_1_07-linux-i586-rpm
3、Tomcat 安装
tar xvzf jakarta-tomcat-5.0.30.tar.gz
mv jakarta-tomcat-5.0.30 /usr/local/tomcat
说明:因为我们下载的是二进制包,所以直接解压就好用,然后直接拷贝到
所要安装的目录下既可
至此,tomcat安装过程就结束了!
4、设置Tomcat环境变量
vi /etc/profile
export JAVA_HOME=/usr/lib/j2se/1.4
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:\
$JAVA_HOME/jre:/usr/local/tomcat/common/lib/servlet.jar
export PATH=$PATH:/usr/lib/j2se/1.4/bin
export CATALINA_HOME=/usr/local/tomcat
让设置的环境变量立刻生效,不用重新启动系统,执行下面指令:
source /etc/profile
四、apache与tomcat整合配置
1、tar xvzf jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
cd jakarta-tomcat-connectors-jk2-2.0.4-src
cd jk/native2
./configure --with-apxs2=/opt/apache2/bin/apxs --with-\
tomcat41=/usr/local/tomcat/
make
cd ../build/jk2/apache2
cp mod_jk2.so /opt/apache2/modules/
或
cd jk//build/jk2/apache2
/usr/local/apache/bin/apxs -n jk2 -i mod_jk2.so
2、配置apache:
vi /opt/apache2/conf/httpd.conf
把DocumentRoot "/usr/local/apache2/htdocs"
改为:
DocumentRoot "/usr/local/tomcat/webapps/ROOT"
把#
改为:
并在DirectoryIndex index.html index.html.var后加上index.jsp
在httpd.conf尾部添加如下内容
LoadModule jk2_module modules/mod_jk2.so
3、生成workers2.properties文件
vi /opt/apache2/conf/workers2.properties
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
[uri:/*.jsp]
worker=ajp13:localhost:8009
[uri:/examples/*]
worker=ajp13:localhost:8009
[uri:/admin/*]
worker=ajp13:localhost:8009
[uri:/admin/servlet/*]
worker=ajp13:localhost:8009
[uri:/manager/*]
worker=ajp13:localhost:8009
4、Tomcat 的启动关闭
启动:
/usr/local/tomcat/bin/startup.sh
关闭:
/usr/local/tomcat/bin/shutdown.sh
5、测试整合是否成功
在/usr/local/tomcat/webapps/ROOT下创建test.jsp
vi test.jsp
<%@ page import="java.util.*,java.sql.*,java.text.*" contentType="text/html;charset=gb2312" %>
<%
out.println("this is a jsp test page!");
%>
访问,内容正常则说明整合成功。
阅读(695) | 评论(0) | 转发(0) |