您的位置:首页 > 运维架构 > Shell

Shell脚本 centOS7中自动安装Tomcat7

2017-07-25 08:33 951 查看
#切换
sduo su

tomcat_dir="/usr/local/tomcat"

#创建tomcat文件夹
if [ ! -d "$tomcat_dir" ];
then
mkdir $tomcat_dir
fi

cd $tomcat_dir

#远程获取tomcat
if [ ! -d "apache-tomcat-7.0.79.tar.gz" ];
then
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.79/bin/apache-tomcat-7.0.79.tar.gz fi

#解压
tar -xvf apache-tomcat-7.0.79.tar.gz

#改变端口 port 8080 to 80
sed -i 's/8080/80/' apache-tomcat-7.0.79/conf/server.xml

#赋予./权限
chmod u+x *.sh

#启动
cd $tomcat_dir/apache-tomcat-7.0.79/bin
./startup.sh
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  shell linux