linux-tutorial/codes/linux/ops/soft/tomcat8-install.sh

35 lines
935 B
Bash
Raw Normal View History

2018-02-01 16:34:02 +08:00
#!/usr/bin/env bash
2019-05-07 14:14:30 +08:00
cat << EOF
###################################################################################
# 安装 Tomcat 脚本
2019-05-07 14:29:16 +08:00
# @system: 适用于所有 linux 发行版本。
# @author: Zhang Peng
###################################################################################
2018-02-01 16:34:02 +08:00
2019-05-07 14:14:30 +08:00
EOF
2018-02-01 16:34:02 +08:00
2019-05-09 11:26:06 +08:00
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then
echo "Usage: sh tomcat8-install.sh [version] [path]"
echo -e "Example: sh tomcat8-install.sh 8.5.28 /opt/tomcat8\n"
fi
version=8.5.28
2019-05-07 14:14:30 +08:00
if [[ -n $1 ]]; then
version=$1
fi
root=/opt/tomcat
if [[ -n $2 ]]; then
root=$2
fi
2019-05-09 11:26:06 +08:00
echo "Current execution: install tomcat8 ${version} to ${root}"
2019-05-07 14:14:30 +08:00
echo -e "\n>>>>>>>>> download tomcat"
mkdir -p ${root}
2018-09-30 17:24:58 +08:00
wget -O ${root}/apache-tomcat-${version}.tar.gz https://archive.apache.org/dist/tomcat/tomcat-8/v${version}/bin/apache-tomcat-${version}.tar.gz
2019-05-07 14:14:30 +08:00
echo -e "\n>>>>>>>>> install tomcat"
2019-05-07 15:04:19 +08:00
tar zxf ${root}/apache-tomcat-${version}.tar.gz -C ${root}