Linux下为Tomcat安装APR
安装apr
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.gz tar zxvf apr-1.7.0.tar.gz cd apr-1.7.0/ ./configure --prefix=/usr/local/apr make make install
安装apr-util
cd /root/ wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz tar zxvf apr-util-1.6.1.tar.gz cd apr-util-1.6.1/ ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make make install
centos查找已安装的jdk路径
which java ls -lrt /usr/bin/java ls -lrt /etc/alternatives/java
安装tomcat-native
tomcat目录为/www/server/tomcat
cd /www/server/tomcat/bin/ tar zxvf tomcat-native.tar.gz cd tomcat-native-1.2.12-src/native/ ./configure --with-apr=/usr/local/webserver/apr --with-java-home=/usr/java/jdk1.8.0_121 make make install
设置apr的环境变量
在/etc/profile中添加以下内容
JAVA_HOME="/usr/java/jdk1.8.0_121" PATH="$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/www/server/mysql/bin:$PATH" CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar LD_LIBRARY_PATH=/usr/local/apr/lib CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/apr/lib" export JAVA_HOME PATH CLASSPATH LD_LIBRARY_PATH CATALINA_OPTS
保存后使profile生效
source /etc/profile
根据运行日志验证
cd /www/server/tomcat/bin/ ./catalina.sh run