Como instalar o componente native library 1.2.3 no Tomcat 7 no CentOS 5/6

O Apache Tomcat Native Library é um componente opcional que permite você utilizar recursos (bibliotecas) nativos do sistema operacional, substituindo componentes Java padrões. Com Native Library instalado é possível melhorar o desempenho do servidor de aplicação.

Caso esteja utilizando CentOS 7 veja esse post.

Ambiente utilizado

CentOS 6
tomcat-native-1.2.3
apache-tomcat-7.0.67
openjdk-1.7

Será necessário compilar alguns pacotes, pois as bibliotecas instaladas por padrão no CentOS 5/6 (RHEL 5/6) não são compatíveis.

Pré-requisitos

openssl 1.0.2
apr-1.5.2
apr-util-1.5.4

openssl 1.0.2

tar xzvf openssl-1.0.2e.tar.gz  
cd openssl-1.0.2e  
./config --prefix=/usr/local --openssldir=/usr/local/openssl
make  
make install  

apr-1.5.2

tar -zxvf apr-1.5.2.tar.gz  
cd apr-1.5.2  
./configure
make  
make install  

apr-util-1.5.4

tar -zxvf apr-util-1.5.4.tar.gz  
cd apr-util-1.5.4  
./configure --with-apr=/usr/local/apr
make  
make install  

tomcat-native-1.2.3

tar xzvf tomcat-native-1.2.3-src.tar.gz  
cd tomcat-native-1.2.3-src/native  
./configure --with-apr=/usr/local/apr --with-java-home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91.x86_64 --with-ssl=yes --prefix=/opt/apache-tomcat-7.0.67
make  
make install  

apache-tomcat-7.0.67

Arquivo: /opt/apache-tomcat-7.0.67/bin/setenv.sh

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib  
export LD_LIBRARY_PATH  

Validação

[root@e803e93e1934 bin]# grep -i native /opt/apache-tomcat-7.0.67/logs/catalina.out
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: :/opt/apache-tomcat-7.0.67/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib  
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: :/opt/apache-tomcat-7.0.67/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib  
INFO: Loaded APR based Apache Tomcat Native library 1.2.3 using APR version 1.5.2.  
[root@e803e93e1934 bin]#