使用 Native Library 在 Linux 系统上安装 Tomcat 7

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4235171/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 00:02:12  来源:igfitidea点击:

Installing Tomcat 7 on Linux system with Native Library

linuxtomcatinstallerlinux-native-library

提问by Mat B.

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

Tomcat 7.0CentOS等Linux系统下如何安装原生库?

采纳答案by Mat B.

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:

Tomcat文件:

#!/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  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  

回答by Mat B.

Just want to point out that the tomcat-native-1.1.20-srcchanges with each new version. So that should be addressed.

只是想指出tomcat-native-1.1.20-src每个新版本的变化。所以应该解决这个问题。

Also backup of files before they are removed would be good idea just in case you need to roll back.

在删除文件之前备份文件也是个好主意,以防万一您需要回滚。