Thursday, January 29, 2015

Compile Tomcat native (with all enabled) for Alfresco on Ubuntu 14.04

First add some need packages
sudo apt-get install fakeroot make gcc openssl libssl-dev  uuid uuid-dev libsctp1 libsctp-dev

Second compile APR
#download site http://apr.apache.org/
wget http://ftp.download-by.net/apache/apr/apr-1.5.1.tar.gz
tar xzvf apr-1.5.1.tar.gz
cd apr-1.5.1/
./configure --enable-nonportable-atomics --enable-threads --enable-posix-shm --enable-allocator-uses-mmap
make
make test
sudo make install


Third compile Tomcat native
#download http://tomcat.apache.org/download-native.cgi
wget http://ftp.download-by.net/apache/tomcat/tomcat-connectors/native/1.1.32/source/tomcat-native-1.1.32-src.tar.gz
tar xzvf tomcat-native-1.1.32-src.tar.gz
cd tomcat-native-1.1.32-src/jni/native
./configure --enable-ocsp --with-apr=/usr/local/apr --with-java-home=/usr/lib/jvm/java-7-openjdk-amd64
make
sudo make install


Fourth edit start script
Add this to you alfresco/catalina. For Loftux script in /etc/init/alfresco, for Alfresco installer in tomcat/bin/setenv.sh

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

Oberve in Alfresco.log or catalina.out something like:
Jan 29, 2015 9:12:11 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: Loaded APR based Apache Tomcat Native library 1.1.32 using APR version 1.5.1.
Jan 29, 2015 9:12:11 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Jan 29, 2015 9:12:11 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1f 6 Jan 2014)


Note: accept filters will only work on BSD