Linux运维

CentOS 6.9 Jdk&Tomcat自动编译安装shell

2017-08-09  本文已影响0人  仞渣

操作系统: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 CentOS

tar 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

上一篇下一篇

猜你喜欢

热点阅读