forked from dunwu/linux-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtomcat8-install.sh
More file actions
34 lines (26 loc) · 935 Bytes
/
tomcat8-install.sh
File metadata and controls
34 lines (26 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
cat << EOF
###################################################################################
# 安装 Tomcat 脚本
# @system: 适用于所有 linux 发行版本。
# @author: Zhang Peng
###################################################################################
EOF
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
if [[ -n $1 ]]; then
version=$1
fi
root=/opt/tomcat
if [[ -n $2 ]]; then
root=$2
fi
echo "Current execution: install tomcat8 ${version} to ${root}"
echo -e "\n>>>>>>>>> download tomcat"
mkdir -p ${root}
wget -O ${root}/apache-tomcat-${version}.tar.gz https://archive.apache.org/dist/tomcat/tomcat-8/v${version}/bin/apache-tomcat-${version}.tar.gz
echo -e "\n>>>>>>>>> install tomcat"
tar zxf ${root}/apache-tomcat-${version}.tar.gz -C ${root}