#!/bin/bash
#---------------------------------------------------------------------
#
# Author : 大象无形
# Date : --
# Mail : wxqian_wxq@.com
# Description: Install tomcat7 and JDK1.
# Equipment :
# )Run this script as root
#
#--------------------------------------------------------------------- #Script's structure
#)Determines if the root user
#)Test the machine JDK version
#)Determine if the file exists
#)install JDK
#)Add the environment variable to /etc/profile
#)Install tomcat
#)Configure tomcat #)Determines if the root user
if [ "$(whoami)" != 'root' ]; then
echo "install need root user"
exit
fi
#)Test the machine JDK version
for i in $(rpm -qa | grep java | grep -v grep)
do
echo "Deleting rpm -> "$i
rpm -e --nodeps $i
done
#)Determine if the file exists
file1=./jdk-8u101-linux-x64.tar.gz
if [ ! -f "$file1" ]; then
echo "need jdk-8u101-linux-x64.tar.gz"
exit
fi file2=./apache-tomcat-7.0..tar.gz
if [ ! -f "$flie2" ]; then
echo "need apache-tomcat-7.0.73.tar.gz"
exit
fi
#)install JDK
echo "========================jdk is installing======================"
tar zxvf jdk-8u101-linux-x64.tar.gz
mv jdk1..0_101 /opt/jdk
echo "jdk1.8.0_101 is rename jdk"
sleep ; #)Add the environment variable to /etc/profile
echo "export JAVA_HOME=/opt/jdk" >> /etc/profile
echo "export PATH=$JAVA_HOME/bin:$PATH" >> /etc/profile
echo "export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar" >> /etc/profile
sleep ;
source /etc/profile
#)Install tomcat
echo "====================apache-tomcat is installing==================="
tar zxvf apache-tomcat-7.0..tar.gz
mv apache-tomcat-7.0. /usr/local/tomcat
cp -p /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat
#)Configure tomcat
sed -i '1a\. /etc/init.d/functions' /etc/init.d/tomcat
sed -i '2a\:' /etc/init.d/tomcat
sed -i '3a\JAVA_HOME=/usr/local/jdk/' /etc/init.d/tomcat
sed -i '4a\CATALINA_HOME=/usr/local/tomcat' /etc/init.d/tomcat
sleep ;
chmod /etc/init.d/tomcat
chkconfig --add tomcat
chkconfig tomcat on
/usr/local/tomcat/bin/startup.sh

最新文章

  1. git配置ssh(github)
  2. 从零开始学 Java - Spring AOP 拦截器的基本实现
  3. myfocus官方网站已经挂掉,相关下载已经从googlecode转到网盘
  4. DOM学习笔记(思维导图)
  5. JS异步加载的三种方式
  6. 我的第一篇博客 ——【ToDoList】小程序开发
  7. 开发错误日志之Unix/Linux命令未执行或无结果等且程序无错误
  8. Win7系统Matlab2013a安装.m文件不自动关联到MATLAB.exe解决方法
  9. linux 下 epoll 编程
  10. UVA_Cubic Eight-Puzzle UVA 1604
  11. mybatis判断list为空
  12. "机器人防火墙":人机识别在应用安全及风控领域的一点实践
  13. [系统集成] RT(Request Tracker)执行自定义脚本及发送微信、短信的实现方法
  14. EF 延时加载与死锁
  15. 极简】如何在服务器上安装SSL证书?
  16. jquery添加
  17. AngularJS封装UEditor
  18. win, cmd下安装mysql(win真tm难用)
  19. 人生苦短之我用Python篇(列表list、字典dict、元组tuple、字符串str)
  20. XJOI 3605 考完吃糖(DAG图dfs)

热门文章

  1. chm转换为html
  2. 关于apache做301的问题
  3. 指定的架构无效。错误: CLR 类型到 EDM 类型的映射不明确
  4. Selenium2学习-039-WebUI自动化实战实例-文件上传下载
  5. Eclipse设置选中高亮显示
  6. ASP.NET MVC 表单submit()
  7. (转载)spring mvc DispatcherServlet详解之一---处理请求深入解析
  8. 原生js拖拽
  9. C++之路进阶——codevs2306(晨跑)
  10. (转)学习使用Jmeter做压力测试(一)--压力测试基本概念