How to install apache tomcat in AWS EC2 instance

What you will learn here about installing Apache tomcat in AWS EC2 instance

  • How to install apache tomcat in AWS EC2 instance
  • Why do I get This site can’t be reached an error

How to install apache tomcat in AWS EC2 instance

Please follow the following steps to install Apache tomcat on AWS EC2 instance

1)Assuming you have created EC2 instance on AWS. In case you do not know how to create an EC2 instance on AWS then please visit the following link to create EC2 instance on AWS.

AWS create ec2 instance

2)In order to install Apache tomcat on AWS, we need to access EC2 instance using SSH client such PuTTY. If you do not know how to access EC2 instance using PuTTY then please visit the following link.

How to access EC2 instance using puTTY

3)Assuming you have followed the above two steps successfully. Now we will start installing apache tomcat on EC2 instance from PuTTy.



4)Please execute the following commands to go in root user mode which is shown below

sudo su
cd ../..

aws install Apache tomcat on EC2 instance

5)Please execute the following command to create a tomcat folder which is shown below

mkdir tomcat

install Apache tomcat on EC2 instance

6)Please execute the following command to navigate in tomcat folder which is shown below

cd tomcat

install Apache tomcat on EC2 instance AWS

7)Please execute the following command to update the existing packages.

sudo apt-get update

install Apache tomcat on EC2 instance AWS

8)In order to run Apache Tomcat, you need a JDK. Execute the following command to install JDK.

sudo apt-get install default-jdk

update existing packages

9)Execute the following command to download Apache Tomcat 8 which is shown below

sudo wget http://mirrors.estointernet.in/apache/tomcat/tomcat-8/v8.5.51/bin/apache-tomcat-8.5.51.zip

How to install apache tomcat in AWS EC2 instance

IMPORTANT NOTE: You will get an error 404 not found when apache-tomcat-8.5.47.zip file is not available in the above path. If you are getting 404 not found error then only follow this step. Right now available apache-tomcat-8.5.47 version is available in step 8 path. In future apache tomcat version may change. To know the available apache tomcat version please open the following URL in any browser and follow the following steps which is shown below.

http://mirrors.estointernet.in/apache/tomcat/tomcat-8/

apache tomcat new version
If there is new version then replace copied path and execute the following command.

sudo wget paste copied path here

IMPORTANT NOTE: If there is a new version available then please replace the version name below in every step.

10)The downloaded file is in zip format. so execute the following command to install unzip which is shown below.

sudo apt-get install unzip

downloaded unzip

11)Execute the following command to unzip downloaded Apache tomcat 8

sudo unzip apache-tomcat-8.5.51.zip

unzip downloaded apache tomcat

12)Execute the following command to check unzip apache tomcat 8. If it showing apache-tomcat-8.5.47 means apache unzip successfully which is shown below.

ls

unziped tomcat file

13)Execute the following command to navigate in the bin folder which is shown below.

cd apache-tomcat-8.5.51/bin/

tomcat bin path



14)Execute the following command to make all sh file executable file

chmod 777 *.sh

make all sh file executable

15)Execute the following command to see all files in bin folder which is shown below.

ls

list all files of apache bin folder

16)Execute the following command to start the Apache tomcat which is shown below

sudo ./startup.sh

run apache tomcat on ec2 instance

17)Now Please open port 8080. If you don’t know how to open port on AWS EC2 instance then please click on the following link.

How to open port on aws ec2 instance

Add the following inbound rule in your EC2 instance security group to open port 8080 on AWS EC2 instance

open port 8080 on AWS ec2 instance

18)Now go to a browser and enter the following URL to check Apache tomcat is working or not which is shown below. If you are able Apache Tomcat default page means Apache Tomcat installed successfully.

EC2 instance Public IP:8080

check Apache tomcat installed successfully

Why do I get This site can’t be reached an error

You will this site can’t be reached

  • When either port 8080 is opened or
  • You are trying access Wrong public IP address of EC2 instance or
  • You are using the wrong Public IP address and wrong port number

Why do I get This site can’t be reached



You may also like...

Leave a Reply