我安装的是tomcat-connectors-1.2.42-src.tar.gz
首先要确保机器上安装了Apache,安装方法见我上一篇:centOS安装Apache
安装好Apache之后,开始装tomcat-connectors,tomcat-connectors实现apache和tomcat的整合。
1.进入下载好的tomcat-connectors-1.2.42-src.tar.gz文件所在目录,执行解压操作:
tar -zxvf tomcat-connectors-1.2.42-src.tar.gz
2.进入解压出的文件夹下的native子目录:
cd tomcat-connectors-1.2.42-src/native
3.进行编译参数配置
./buildconf.sh
报错:autoconf not found.
You need autoconf version 2.59 ornewer installed
to build mod_jk from SVN.
原因是没有安装autoconf (有博客说是要安装libtool)
索性就两个都安装,命令行:
yum install autoconf
yum installlibtool
4. 继续./buildconf.sh
显示
buildconf: checking installation... buildconf: autoconf version 2.63 (ok) buildconf: libtool version 2.2.6 (ok) buildconf: libtoolize --automake --copy buildconf: aclocal buildconf: autoheader buildconf: automake -a --foreign --copy buildconf: autoconf |
5、继续进行编译参数配置,命令行
./configure--with-apxs=/usr/local/apache2/bin/apxs \
--with-java-home=$JAVA_HOME--with-java-platform=2 \
--enable-jni
报错:hecking for mkdir... /bin/mkdir
need to check for Perl first, apxsdepends on it...
checking for perl... /usr/bin/perl
could not find/usr/local/apache2/bin/apxs
configure: error: You must specify avalid --with-apxs path
原因是/usr/local/apache/bin/apxs文件需要改
解决办法:
vi /usr/local/apache/bin/apxs
第一行的#!/replace/with/path/to/perl/interpreter -w,找到你perl的安装位置,如果不清楚,可以用which perl找到,一般在/usr/bin/perl,于是将第一行改为:#!/usr/bin/perl -w.
退出并保存后,再一次编译参数配置,命令行:
./buildconf.sh
./configure--with-apxs=/usr/local/apache2/bin/apxs \
--with-java-home=$JAVA_HOME --with-java-platform=2\
--enable-jni
显示:configure: WARNING: unrecognized options: --with-java-home,--with-java-platform, --enable-jni
不用管它
6. 编译安装
make
make install
不报错大段代码开始显示,一路biubiubiu 安装结束
此时去/usr/local/apache2/modules/下找到mod_jk.so文件,表示安装成功。