Skip to content

Commit 4c9bfb1

Browse files
authored
Create TomcatInstallation_EC2.md
1 parent 7a661a5 commit 4c9bfb1

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

TomcatInstallation_EC2.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Tomcat installation on EC2 instance
2+
Follow this video lecture in Valaxy Technologies YouTube Channel
3+
Complete DevOps Project course on Udemy
4+
Pre-requisites
5+
EC2 instance with Java v1.8.x
6+
Install Apache Tomcat
7+
Download tomcat packages from https://tomcat.apache.org/download-80.cgi onto /opt on EC2 instance
8+
Note: Make sure you change <version> with the tomcat version which you download.
9+
10+
# Create tomcat directory
11+
cd /opt
12+
wget http://mirrors.fibergrid.in/apache/tomcat/tomcat-8/v8.5.35/bin/apache-tomcat-8.5.35.tar.gz
13+
tar -xvzf /opt/apache-tomcat-<version>.tar.gz
14+
give executing permissions to startup.sh and shutdown.sh which are under bin.
15+
chmod +x /opt/apache-tomcat-<version>/bin/startup.sh
16+
chmod +x /opt/apache-tomcat-<version>/bin/shutdown.sh
17+
Note: you may get below error while starting tomcat incase if you dont install Java
18+
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this program
19+
20+
create link files for tomcat startup.sh and shutdown.sh
21+
ln -s /opt/apache-tomcat-<version>/bin/startup.sh /usr/local/bin/tomcatup
22+
ln -s /opt/apache-tomcat-<version>/bin/shutdown.sh /usr/local/bin/tomcatdown
23+
tomcatup
24+
Check point :
25+
access tomcat application from browser on port 8080
26+
27+
http://<Public_IP>:8080
28+
Using unique ports for each application is a best practice in an environment. But tomcat and Jenkins runs on ports number 8080. Hence lets change tomcat port number to 8090. Change port number in conf/server.xml file under tomcat home
29+
30+
cd /opt/apache-tomcat-<version>/conf
31+
# update port number in the "connecter port" field in server.xml
32+
# restart tomcat after configuration update
33+
tomcatdown
34+
tomcatup
35+
Check point :
36+
Access tomcat application from browser on port 8090
37+
38+
http://<Public_IP>:8090
39+
now application is accessible on port 8090. but tomcat application doesnt allow to login from browser. changing a default parameter in context.xml does address this issue
40+
#search for context.xml
41+
find / -name context.xml
42+
above command gives 3 context.xml files. comment () Value ClassName field on files which are under webapp directory. After that restart tomcat services to effect these changes. At the time of writing this lecture below 2 files are updated.
43+
/opt/tomcat/webapps/host-manager/META-INF/context.xml
44+
/opt/tomcat/webapps/manager/META-INF/context.xml
45+
46+
# Restart tomcat services
47+
tomcatdown
48+
tomcatup
49+
Update users information in the tomcat-users.xml file goto tomcat home directory and Add below users to conf/tomcat-users.xml file
50+
<role rolename="manager-gui"/>
51+
<role rolename="manager-script"/>
52+
<role rolename="manager-jmx"/>
53+
<role rolename="manager-status"/>
54+
<user username="admin" password="admin" roles="manager-gui, manager-script, manager-jmx, manager-status"/>
55+
<user username="deployer" password="deployer" roles="manager-script"/>
56+
<user username="tomcat" password="s3cret" roles="manager-gui"/>
57+
Restart serivce and try to login to tomcat application from the browser. This time it should be Successful

0 commit comments

Comments
 (0)