安装tomcat集成jsvc、apr并配置为后台服务(操作系统CentOS x.x.x)

添加用户
# groupadd xz_server
# useradd -g xz_server xz_lan
设置用户口令为 4tomcat
# passwd xz_lan

安装JDK
# cd /var/tomcat/res
# tar -zvxf jdk-7u5-linux-x64.tar.gz
mv jdk1.7.0_05 /var/tomcat/jdk1.7.0_05
# vi /etc/profile //在最后加上以下内容
JAVA_HOME=/var/tomcat/jdk1.7.0_05  
export JAVA_HOME   
CLASSPATH=/var/tomcat/jdk1.7.0_05/lib:/var/tomcat/jdk1.7.0_05/jre/lib:.   
export CLASSPATH  
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin   
export PATH   
JRE=/var/tomcat/jdk1.7.0_05/jre   
export JRE

安装tomcat
# cd /var/tomcat/res
# tar -zvxf apache-tomcat-7.0.29.tar.gz
# mv apache-tomcat-7.0.29 /var/tomcat/tomcat

安装jsvc
# cd /var/tomcat/tomcat/bin/                  //进入安装目录
# tar -zvxf commons-daemon-native.tar.gz                        //解压
# cd commons-daemon-1.0.10-native-src/unix  //进入jsvc-src目录
# autoconf
# ./configure --with-java=/var/tomcat/jdk1.7.0_05
# make

安装APR
# cd /var/tomcat/res
# tar zxvf apr-1.3.8.tar.gz 
# cd apr-1.3.8
# chmod a+x configure
# ./configure --prefix=/var/tomcat/tomcat/apr
# make && make install

安装APR-UTIL
# cd /var/tomcat/res
# tar zxvf apr-util-1.3.9.tar.gz
# cd apr-util-1.3.9
# ./configure --prefix=/var/tomcat/tomcat/apr-util --with-apr=/var/tomcat/tomcat/apr
# make && make install

编译安装Native
# cd /var/tomcat/tomcat/bin
# tar zxvf tomcat-native.tar.gz
# cd tomcat-native-1.1.24-src/jni/native
# ./configure --prefix=/var/tomcat/tomcat/apr --with-apr=/var/tomcat/tomcat/apr --with-java-home=/var/tomcat/jdk1.7.0_05
# make && make install

把tomcat_xz文件复制到/etc/init.d目录下换名为tomcat(见下一篇)

更改tomcat安装目录权限
# chown -R xz_lan:xz_server /var/tomcat
# chown -R xz_lan:xz_server /var/tomcat/*

建立软连接(开机自启动)
# ln -s /etc/init.d/tomcat /etc/rc.d/rc3.d/K01tomcat
# ln -s /etc/init.d/tomcat /etc/rc.d/rc3.d/S99tomcat
# ln -s /etc/init.d/tomcat /etc/rc.d/rc5.d/K01tomcat
# ln -s /etc/init.d/tomcat /etc/rc.d/rc5.d/S99tomcat

或设置为后台服务
# /sbin/chkconfig --del tomcat
# /sbin/chkconfig --add tomcat
# /sbin/chkconfig --list tomcat

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。