安装apr来提高tomcat 的可伸缩性和性能
一,下载apr 和 apr-util最新版
[root@tomcat tomcat]# cd /usr/local/
[root@tomcat tomcat]# wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz
[root@tomcat tomcat]# wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.4.tar.gz
二,解压文件
[root@tomcat tomcat]#tar -zxvf apr-
1.5
.
2
.tar.gz
[root@tomcat tomcat]#tar -zxvf apr-util-
1.5
.
4
.tar.gz
三,安装apr和apr-util
[root@tomcat tomcat]# cd apr-1.5.2
[root@tomcat tomcat]# ./configure --prefix=/usr/local/apr
[root@tomcat tomcat]# make && make install
[root@tomcat tomcat]# cd .. && cd apr-util-1.5.4
[root@tomcat tomcat]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@tomcat tomcat]# make && make install
四,安装 tomcat-native
[root@tomcat src]# wget http://apache.fayea.com/tomcat/tomcat-connectors/native/1.1.33/source/tomcat-native-1.1.33-src.tar.gz
[root@tomcat tomcat]# cd /usr/local/src
[root@tomcat tomcat]# tar -zxf tomcat-native-1.1.33-src.tar.gz
[root@tomcat tomcat]# cd tomcat-native-1.1.33-src/jni/native
[root@tomcat tomcat]# ./configure --with-apr=/usr/local/apr --with-java-home=/usr/local/java
[root@tomcat tomcat]# make && make install
五, 设置 apr 的环境变量
[root@tomcat tomcat]# vim /etc/profile
export PATH=$PATH:/usr/local/apr/lib
[root@tomcat tomcat]# source /etc/profile
六,启动tomcat并查看catalina.out
[root@tomcat tomcat]# bin/startup.sh
[root@tomcat tomcat]# tail -f catalina.out
日志内容 org.apache.catalina.core.AprLifecycleListener.init Loaded APR based Apache Tomcat Native library 1.1.29 using APR version 1.5.0.
则apr安装成功。