操作系统:CentOS 6.9 x64 mini
JDK : jdk1.8.0_144
Tomcat : tomcat 7.0.79
#!/bin/sh
# Auther: Mr.G Mail:cmaoge@126.com
# QQ:825312600
# Jdk & Tomcat Install For CentOStar zxvf jdk-8u144-linux-x64.tar.gz
mkdir /www/server/java
mv jdk1.8.0_144/ /www/server/java/
cat >>/etc/profile<<"eof"
JAVA_HOME=/www/server/java/jdk1.8.0_144
export PATH="$PATH:$JAVA_HOME/bin"
export CLASSPATH=".:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar"
eof
source /etc/profile#解压tomcat 并移动到指定目录
# Tomcat 7.0.79
tar zxvf apache-tomcat-7.0.79.tar.gz
mv apache-tomcat-7.0.79 /www/server/tomcat7
sed -i "N;4i\# description:Tomcat service" /www/server/tomcat7/bin/catalina.sh
sed -i "N;4i\#chkconfig: 2345 10 90" /www/server/tomcat7/bin/catalina.sh
sed -i "N;22i\JAVA_HOME=/www/server/java/jdk1.8.0_144" /www/server/tomcat7/bin/catalina.sh
sed -i "N;22i\CATALINA_HOME=/www/server/tomcat7" /www/server/tomcat7/bin/catalina.sh
ln -sf /www/server/tomcat7/bin/catalina.sh /etc/init.d/tomcat7
chmod 755 /etc/init.d/tomcat7
chkconfig --add tomcat7
chkconfig tomcat7 on
service tomcat7 status
echo "/www/server/tomcat7/bin/startup.sh" >> /etc/rc.local
网友评论