CentOS 源码安装apr(Apache Portal Rumtime),集成到tomcat

时间:2022-06-01 16:46:45

安装apr目的是提高tomcat 的可伸缩性和性能

cd /usr/local/

1. 下载apr 和 apr-util最新版

wget  https://mirror.bit.edu.cn/apache//apr/apr-1.7.0.tar.gz
wget https://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

2. 解压文件

tar -zxvf apr-1.7.0.tar.gz 
tar -zxvf aor-util-1.6.1.tar.gz

3. 安装apr和apr-util

cd apr-1.5.0 
./configure --prefix=/usr/local/apr
make
make install
cd .. 
cd apr-util-1.5.3
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make insatll

4. 安装 tomcat-native

cd /usr/local/tomcat/bin
tar -zxvf tomcat-native.tar.gz
cd tomcat-native-1.1.29-src/jni/native
./configure --with-apr=/usr/local/apr --with-java- home=/usr/java/jdk1.7.0_25
make
make install

5. 设置 apr 的环境变量

vi /etc/profile   

在文本的最后面添加以下内容

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib   

使profile生效,

source /etc/profile

6. 启动tomcat并查看catalina.out

./startup.sh 
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安装成功