DEV Community

Cover image for Installing Tomcat on an EC2 instance
Souleymane. Tiendrebeogo for AWS Community Builders

Posted on • Updated on

Installing Tomcat on an EC2 instance

Prerequisite: You will need to have an Amazon account
Log into your amazon account and launch and EC2 instance. I chose the free tier here and launched the EC2 instance will be running Amazon Linux 2. I have a detailed article on how to launch and EC2 machine here.
Make sure that we have Java JDK11 also installed on our Amazon EC2 instance. Only after that, we can proceed with the installation.
Tomcat runs on port number 8080 so make you have that open in your instance Security Group.

SecurityGroup

I used MobaXterm to SSH into my EC2 instance, but you are free to use whatever tool you like. Start and SSH session, enter your remote host IP, username and then under advance tab, load your privatKey

MobaXterm

Make sure that you have root access on your EC2 instance and then proceed with Java JDK11 installation and check your Java version after the the installation to make sure.



amazon-linux-extras install java-openjdk11
java -version


Enter fullscreen mode Exit fullscreen mode

Java

After that, install TomCat by grabbing the link on TomCat official website



wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.65/bin/apache-tomcat-9.0.65.tar.gz


Enter fullscreen mode Exit fullscreen mode

Image description

Extract and install it with the line bellow



tar -xvzf apache-tomcat-9.0.65.tar.gz


Enter fullscreen mode Exit fullscreen mode

cd to Tomcat and run ll to see the content. From the content cd to the bin folder and from there you will be able to start your tomcat server with ./startup or shut it down with the ./shutdown command



cd apache-tomcat-9.0.65
ll
cd bin
ll
./shutdown
./startup



Enter fullscreen mode Exit fullscreen mode

Form there you will be able to access your tomcat server with your instance IP fronted by port 8080, which is the default for Tomcat

TomCatHome

Happy install TomCatUp!

Top comments (0)