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