Apache Tomcat Installation And Setup In AWS EC2 Redhat Instance.
AWS Acccount.
Create Redhat EC2 T2.micro Instnace.
Create Security Group and open Tomcat ports or Required ports.
Attach Security Group to EC2 Instance.
Install java openJDK 1.8+
Tomcat version 9.0.62 with Java JDK 1.8+
Java JDK 1.8+ is the pre-requisite for tomcat to run
#! /bin/bash
# Use this script to install tomcat in rehat servers
echo delete the failed version of tomcat
sudo rm -rf /opt/tomcat9
echo assign a hostname to your server
sudo hostname tomcat
# install Java JDK 1.8+ as a pre-requisit for tomcat to run.
cd /opt
sudo yum install git wget -y
sudo yum install java-1.8.0-openjdk-devel -y
# Download tomcat software and extract it.
sudo yum install wget unzip -y
sudo wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.62/bin/apache-tomcat-9.0.62.tar.gz
sudo tar -xvf apache-tomcat-9.0.62.tar.gz
sudo rm apache-tomcat-9.0.62.tar.gz
sudo mv apache-tomcat-9.0.62 tomcat9
sudo chmod 777 -R /opt/tomcat9
sudo chown ec2-user -R /opt/tomcat9
sh /opt/tomcat9/bin/startup.sh
# create a soft link to start and stop tomcat
sudo ln -s /opt/tomcat9/bin/startup.sh /usr/bin/starttomcat
sudo ln -s /opt/tomcat9/bin/shutdown.sh /usr/bin/stoptomcat
sudo yum update -y
starttomcat