Skip to content
Advertisement

Installing Tomcat 7 on Linux system with Native Library

How do you install native library for Tomcat 7.0 under Linux system such as CentOS?

Advertisement

Answer

Installer

wget ftp:\yourdeployment.server.local/tomcat7.tar.gz  
tar xvzf tomcat7.tar.gz   
cp -f tomcat /usr/share/tomcat7 
rm -f /usr/share/tomcat  
ln -s /usr/share/tomcat7 /usr/share/tomcat    
chmod 777 /usr/share/tomcat7/bin/ *.sh    
useradd -d /usr/share/tomcat -s /sbin/nologin tomcat  
chown -R tomcat /usr/share/tomcat7    
rm -f /etc/init.d/tomcat  
cp -f /usr/share/tomcat7/tomcat /etc/init.d/  
chmod +x /etc/init.d/tomcat    
rm -f /etc/profile.d/env.sh  
cp -f /usr/share/tomcat7/env.sh /etc/profile.d/  
chmod +x /etc/profile.d/env.sh    
chmod 755 /etc/init.d/tomcat    

Native package installation

cd /usr/share/tomcat7/bin  
tar -xvzf tomcat-native.tar.gz  
cd tomcat-native-<replace with current version>-src/jni/native  
./configure --with-apr=/usr && make && sudo make install  
cd /usr/lib  
rm -f libtcnative-1.so  
ln -s /usr/local/apr/lib/libtcnative-1.so libtcnative-1.so  
init 6  

tomcat file:

#!/bin/bash  
 chkconfig: 234 20 80  
 description: Tomcat Server basic start/shutdown script  
 processname: tomcat  

export JAVA_HOME=/jdk7  
export TOMCAT_HOME=/usr/share/tomcat7  
export JEE_JAR=/jdk7  
export JRE_HOME=/jdk7/jre  
export PATH=$PATH:$JAVA_HOME/bin  
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar  

case $1 in  
start)  
  sh /usr/share/tomcat7/bin/startup.sh  
;;
stop)
  sh /usr/share/tomcat7/bin/shutdown.sh
;;  
restart)  
  sh /usr/share/tomcat7/bin/shutdown.sh  
  sh /usr/share/tomcat7/bin/startup.sh  
;;  
esac  
exit 0  

env.sh

export JAVA_HOME=/jdk7  
export JRE_HOME=$JAVA_HOME  
export TOMCAT_HOME=/usr/share/tomcat7  
export PATH=$PATH:$JAVA_HOME/bin  
export CLASSPATH=.:$JRE_HOME/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar  
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement