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