一、安装apr
[www@passport-test02 ~]# tar xf apr-1.5.1.tar.gz
[www@passport-test02 ~]# cd apr-1.5.1
[www@passport-test02 apr-1.5.1]# ./configure --prefix=/usr/local/apr
错误:rm: cannot remove `libtoolT': No such file or directory
解决方法:
[www@passport-test02 apr-1.5.1]# vim configure
将
RM='$RM'
改成:
RM='$RM -f'
[www@passport-test02 apr-1.5.1]# make && make install
二、安装apr-util
[www@passport-test02 ~]# tar xf apr-util-1.5.1.tar.bz2
[root@passport-test02 www]# cd apr-util-1.5.1
[root@passport-test02 apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
[root@passport-test02 apr-util-1.5.1]# make && make install
三、安装tomcat-native
[root@passport-test02 www]# cd /opt/tomcat7/bin
[root@passport-test02 bin]# tar xf tomcat-native.tar.gz
[root@passport-test02 bin]# cd tomcat-native-1.1.32-src/jni/native/
[root@passport-test02 native]# ./configure --with-apr=/usr/local/apr --with-java-home=/opt/jdk1.6.0_45
[root@passport-test02 native]# make && make install
四、配置tomcat apr模式
1.编辑/etc/profile:
[www@passport-test02 ~]# vim /etc/profile
export export LD_LIBRARY_PATH=/usr/local/apr/lib
[www@passport-test02 ~]# source /etc/profile
2.编辑tomcat的启动脚本:
[root@passport-test02 ~]# vim /opt/tomcat7/bin/catalina.sh
CATALINA_OPTS=-Djava.library.path=/usr/local/apr/lib
3.编辑tomcat的配置文件:
[root@passport-test02 ~]# vim /opt/tomcat7/conf/server.xml
<Connector port="8080" protocol="org.apache.coyote.http11.Http11AprProtocol"/>
4.重启tomcat
查看日志,出现如下记录,表明apr模式安装成功
INFO: Starting ProtocolHandler ["http-apr-8080"]
Dec 4, 2015 10:05:25 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8019"]
Dec 4, 2015 10:05:25 AM org.apache.catalina.startup.Catalina start