日期:2014-05-17  浏览次数:20886 次

Apache HttpServer与Tomcat搭建集群全记录

1.软件准备: ???

??? Tomcat版本:apache-tomcat-6.0.35.tar.gz
??? Apache Http-Server 版本:httpd-2.2.22.tar.gz
??? Tomcat-Connectors:tomcat-connectors-1.2.32-src.tar.gz
??? JDK版本:jdk1.6.0_29

??? 前三个可以到apache 官网上下载,JDK到oracle 官网上下载。

?

2.服务器环境

?? Red Hat Enterprise Linux Server release 5.4

?

3.JDK的安装

?? JDK安装(略),请详见帖子? Linux下的JDK安装与卸载

?

4.Tomcat的安装

??? 解压? tar -zxvf apache-tomcat-6.0.35.tar.gz

?

5.http server 安装

???? 1)解压 tar -zxvf httpd-2.2.22.tar.gz

??? 2)cd httpd-2.2.22

??? 3)进行编译参数配置

????????? ]# ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all

???????? 关于configure参数的更多内容可参考:
???????? http://httpd.apache.org/docs/2.2/en/programs/configure.html#installationdirectories

??? 4)编译安装

???????? ]#make

???????? ]#make install


??? 请注意:在进行第4步安装时,报Cannot use an external APR with the bundled APR-util错误的解决办法

??? 4.1)进入httpd-2.2.22目录下的srclib 进行apr的安装

??????????? ]#cd srclib/apr

??????????? ]#./configure --prefix=/usr/local/apr

??????????? ]#make

??????????? ]#make install

??? 4.2)进入httpd-2.2.22目录下的srclib 进行apr-util的安装

??????????? ]#cd srclib/apr-util

??????????? ]#./configure --prefix=/usr/local/apr-util? --with-apr=/usr/local/apr

??????????? ]#make

??????????? ]#make install


???? 4.3)返回到httpd-2.2.22目录下 进行httpserver的安装

??????????? ]#cd ..

??????????? ]#./configure --prefix=/usr/local/apache2 --enable-mods-shared=all \
???????????????? --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/bin


???? 5) 启动和关闭apache
??????????? 完成上述步骤后,apache的安装就结束了,通过下面的命令启动和关闭apache:
??????????? 启动:/usr/local/apache2/bin/apachectl start
??????????? 关闭:/usr/local/apache2/bin/apachectl stop

?

6.Apache Tomcat Connector(生产mod_jk)的安装

????? 1)解压tomcat-connectors-1.2.32-src.tar.gz

?????????? ]#tar -zxvf tomcat-connectors-1.2.32-src.tar.gz

????? 2)进入解压出的文件夹下的native子目录
?????????? ]#cd tomcat-connectors-1.2.32-src