forked from aglover/ubuntu-equip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
equip_tomcat8.sh
executable file
·62 lines (43 loc) · 1.36 KB
/
equip_tomcat8.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
#
# Ubuntu Equip
# Tomcat 8 (latest version 8.0.30 http://tomcat.apache.org/download-80.cgi)
# Licence: MIT
# to run: wget --no-check-certificate https://github.com/furkanvarol/ubuntu-equip/raw/master/equip_tomcat8.sh && bash equip_tomcat8.sh [version]
if [ -d "/opt/tomcat" ]; then
echo "Tomcat already installed in /opt/tomcat, skipping!"
rm -f equip_tomcat8.sh
exit 0
fi
VERSION="8.0.30"
if (( "$#" == 1 )); then
VERSION=$1
fi
FILENAME="apache-tomcat-$VERSION.tar.gz"
LINK="http://www.eu.apache.org/dist/tomcat/tomcat-8/v$VERSION/bin/$FILENAME"
echo "$LINK"
wget --no-check-certificate "$LINK"
mkdir tomcat
tar -zxvf $FILENAME -C tomcat --strip-components 1
# Will copy to /opt
sudo mv tomcat /opt/
# Cleanup
rm -f $FILENAME
rm -f equip_tomcat8.sh
# Create Tomcat User
sudo groupadd tomcat
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
# Updating Permissions
cd /opt/tomcat
sudo chgrp -R tomcat conf
sudo chmod g+rwx conf
sudo chmod g+r conf/*
sudo chown -R tomcat work/ temp/ logs/
# Exporting Catalina Home
sudo sh -c 'export "CATALINE_HOME=/opt/tomcat" >> ~/.bashrc'
source ~/.bashrc
# Configuring Tomcat Web Management Interface
sudo sh -c 'echo "<tomcat-users>
<user username=\"admin\" password=\"password\" roles=\"manager-gui,admin-gui\"/>
</tomcat-users>" > /opt/tomcat/conf/tomcat-users.xml'
echo "Installed in /opt/tomcat"