安装apr来提高tomcat 的可伸缩性和性能
1 cd /usr/local/
下载apr 和 apr-util最新版
1 wget http://apache.fayea.com/apache-mirror//apr/apr-1.5.0.tar.gz 2 3 wget http://apache.fayea.com/apache-mirror//apr/apr-util-1.5.3.tar.gz
解压文件
1 tar -zxvf apr-1.5.0.tar.gz 2 tar -zxvf aor-util-1.5.3.tar.gz
安装apr和apr-util
1 cd apr-1.5.0 2 3 ./configure --prefix=/usr/local/apr 4 5 make 6 7 make install 8 9 cd .. 10 11 cd apr-util-1.5.3 12 13 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr 14 15 make 16 17 make insatll
安装 tomcat-native
1 cd /usr/local/tomcat/bin 2 tar -zxvf tomcat-native.tar.gz 3 cd tomcat-native-1.1.29-src/jni/native 4 ./configure --with-apr=/usr/local/apr --with-java- home=/usr/java/jdk1.7.0_25 5 make 6 make install
设置 apr 的环境变量
1 vi /etc/profile 2 3 #在文本的最后面添加以下内容 4 5 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib 6 7 #使profile生效, 8 9 source /etc/profile
启动tomcat并查看catalina.out
1 ./startup.sh 2 3 cat 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安装成功