Tomcat-APR/tomcat-native的安装和配置


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.安装apr-iconv

# tar zxvf apr-iconv-1.2.1.tar.gz
# cd apr-iconv-1.2.1
# ./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr 
# make
# make install



5、安装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 

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


三、配置Apr的环境变量


[root@jw-srv jdk1.6.0_35]# cd /usr/local/tomcat/bin/
[root@jw-srv bin]# vim catalina.sh     //增加以下行
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib


四、启动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 environmentswas 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的环境变量,必须增加apr的环境变量。


本文出自 “开开心心每一天” 博客,请务必保留此出处http://as007012.blog.51cto.com/6215447/1614521

你可能感兴趣的:(tomcat优化)