自动安装tomcat的shell脚本
时间:2015-08-27 19:04 来源:linux.it.net.cn 作者:IT
#!/bin/bash
#Auto Install JDK、tomcat and they connector.
#执行这个脚本需要在/soft目录下放好JDK、tomcat、的tar.gz源码包,
#以及已经执行过的jdk(本人无法做到在jdk执行时输入Enter和空格,所以这一步骤需要手动做。)
#tomcat安装到/data/conf/tomcat,已设置环境变量。
#JDv安装>/data/conf/jdk,已设置环境变量。
# 20110401 lwz_benet@163.com Version 1.0 write:fallenleaves QQ:543302969
echo "===========================Began installing============================="
if [ ! -d /opt/conf ]
then
mkdir -p /opt/conf
else
echo "This directory is already exists"
fi
#Auto Install JDK
cd /soft
chmod 700 jdk*
./jdk-6u24-linux-i586.bin
mv jdk1.6.0_24/ /opt/conf/jdk
rm -rf /usr/bin/java
rm -rf /usr/bin/javac
ln -s /opt/conf/jdk/bin/java /usr/bin/java
ln -s /opt/conf/jdk/bin/javac /usr/bin/javac
java -version
sleep 5
javac -version
echo ""
echo ""
echo "====================Auto Install JDK Have finished======================"
#Auto Install tomcat
for i in `seq 1 3`
do
mkdir -p /opt/conf/tomcat$i
cd /soft
tar xzvf apache-tomcat-7.0.12.tar.gz
mv apache-tomcat-7.0.12/* /opt/conf/tomcat$i
cat >> /etc/profile << EFF
TOMCAT$i=/opt/conf/tomcat$i
EFF
done
cat >> /etc/profile << FFG
JAVA_HOME=/opt/conf/jdk
JRE_HOME=/opt/conf/jdk/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$TOMCAT1/bin:$TOMCAT2/bin:$TOMCAT3/bin/
export JAVA_HOME JRE_HOME PATH TOMCAT1 TOMCAT2 TOMCAT3
FFG
source /etc/profile
(责任编辑:IT)
#!/bin/bash #Auto Install JDK、tomcat and they connector. #执行这个脚本需要在/soft目录下放好JDK、tomcat、的tar.gz源码包, #以及已经执行过的jdk(本人无法做到在jdk执行时输入Enter和空格,所以这一步骤需要手动做。) #tomcat安装到/data/conf/tomcat,已设置环境变量。 #JDv安装>/data/conf/jdk,已设置环境变量。 # 20110401 lwz_benet@163.com Version 1.0 write:fallenleaves QQ:543302969 echo "===========================Began installing=============================" if [ ! -d /opt/conf ] then mkdir -p /opt/conf else echo "This directory is already exists" fi #Auto Install JDK cd /soft chmod 700 jdk* ./jdk-6u24-linux-i586.bin mv jdk1.6.0_24/ /opt/conf/jdk rm -rf /usr/bin/java rm -rf /usr/bin/javac ln -s /opt/conf/jdk/bin/java /usr/bin/java ln -s /opt/conf/jdk/bin/javac /usr/bin/javac java -version sleep 5 javac -version echo "" echo "" echo "====================Auto Install JDK Have finished======================" #Auto Install tomcat for i in `seq 1 3` do mkdir -p /opt/conf/tomcat$i cd /soft tar xzvf apache-tomcat-7.0.12.tar.gz mv apache-tomcat-7.0.12/* /opt/conf/tomcat$i cat >> /etc/profile << EFF TOMCAT$i=/opt/conf/tomcat$i EFF done cat >> /etc/profile << FFG JAVA_HOME=/opt/conf/jdk JRE_HOME=/opt/conf/jdk/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$TOMCAT1/bin:$TOMCAT2/bin:$TOMCAT3/bin/ export JAVA_HOME JRE_HOME PATH TOMCAT1 TOMCAT2 TOMCAT3 FFG source /etc/profile (责任编辑:IT) |