添加用户
# 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