-
Notifications
You must be signed in to change notification settings - Fork 28
/
Tomcat_on_ec2.yml
60 lines (28 loc) · 2.13 KB
/
Tomcat_on_ec2.yml
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
##This guide will help you to setup tomcat on EC2 and deploy a sample.war package on the server##
Step 1 : Launch an EC2 instance. You can choose your AMI. I am using "Amazon Linux AMI". Login to the instance.
Make sure you have installed java on the ec2 instance. If not, run the below command to install java.
yum install java -y
Once installation is done, you can verify the installation by running the below command.
java -version
Step 2 : Download tomcat from the following URL : https://mirrors.estointernet.in/apache/tomcat/tomcat-8/v8.5.53/bin/apache-tomcat-8.5.53.tar.gz
I am using tomcat version 8. You can run the below command to download the tomcat to your instance.
Wget https://mirrors.estointernet.in/apache/tomcat/tomcat-8/v8.5.53/bin/apache-tomcat-8.5.53.tar.gz
Step 3 : Untar the downloaded files. You can run the below command.
tar -xzf apache-tomcat-8.5.53.tar.gz. This will untar the file.
Step 4 : Rename the folder to tomcat. Run the below command.
mv apache-tomcat-8.5.53 tomcat
Step 5 : Move the folder to /usr/local. This step is optional but recommended. Run the below command.
cp -R tomcat /usr/local/
Step 6 : Go to the tomcat folder and change your location to webapps. Download the sample.war file to this location. You can download the war file from the below url.
https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war. You can run the below command to download to the instance.
wget https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war
Step 7 : Go to the bin location in the tomcat folder. Run the below command.
cd bin/
./catalina.sh start : This will start the tomcat server and it should be running on port number 8080.
Make sure you open the port in the security group.
Step 8 : Go to the browser and access the following :
ipaddress:8080/sample
You should be able to see the sample war file running in the tomcat server.
If you are getting any errors, you can look at the logs for the tomcat servers. The logs are present in the logs folder under the tomcat directory.
cd logs
nano catalina.out : This will contain the logs.