一、环境

1、操作系统:CentOS release 5.6

2、应用软件:apr-1.4.6.tar.gz     apr-util-1.4.1.tar.gz     tomcat-native.tar.gz

二、安装

1、检查是否安装openssl

[root@jw-srv software]# rpm -qa |grep openssl
openssl-devel-0.9.8e-12.el5_5.7
openssl-0.9.8e-12.el5_5.7
openssl-devel-0.9.8e-12.el5_5.7
openssl-0.9.8e-12.el5_5.7 

2、安装apr

[root@jw-srv software]# tar -zxvf apr-1.4.6.tar.gz 
[root@jw-srv software]# cd apr-1.4.6
[root@jw-srv apr-1.4.6]# ./configure
[root@jw-srv apr-1.4.6]# make
[root@jw-srv apr-1.4.6]#
make install

3、安装apr-util

[root@jw-srv software]# tar -zxvf apr-util-1.4.1.tar.gz
[root@jw-srv software]# cd  apr-util-1.4.1
[root@jw-srv apr-util-1.4.1]# ./configure --with-apr=/usr/local/apr/
[root@jw-srv apr-util-1.4.1]# make
[root@jw-srv apr-util-1.4.1]# make install

4、安装tomcat-native

[root@jw-srv software]# tar -zxvf tomcat-native.tar.gz 
[root@jw-srv software]# cd  tomcat-native-1.1.22-src/jni/native|
[root@jw-srv native]# ./configure --with-apr=/usr/local/apr/ --with-java-home=/usr/java/jdk1.6.0_35 --prefix=/opt/zhubao/service

[root@jw-srv native]# make
[root@jw-srv native]# make install

三、配置Apr的环境变量

[root@jw-srv jdk1.6.0_35]# cd /opt/zhubao/service/bin/
[root@jw-srv bin]# vim catalina.sh     //在配置文件86行增加以下参数
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/zhubao/service/lib
export LD_LIBRARY_PATH

四、启动tomcat,看日志文件

[root@jw-srv bin]# cd ../logs/
[root@jw-srv logs]# vim catalina.out
2013-4-12 16:46:18 org.apache.catalina.core.AprLifecycleListener init
信息: Loaded APR based Apache Tomcat Native library 1.1.22.
2013-4-13 10:48:36 org.apache.catalina.core.AprLifecycleListener init
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].

//证明apr配置成功啦!

   假如启动之后日志文件还是出现以下:

 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jdk1.6.0_35/jre/lib/amd64/server:/usr/java/jdk1.6.0_35/jre/lib/amd64:/usr/java/jdk1.6.0_35/jre/../lib/amd64::/usr/local/apr/lib:/usr/local/apr/lib:/usr/local/apr/lib:/usr/local/apr/lib:/usr/local/apr/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/li

    在配置文件catalina.sh里面没有配置好APR的环境变量,必须在86行后增加apr的环境变量。