Deploying Apache Tomcat Web Server on AWS EC2 with Red Hat OS: Step-by-Step Guide for Web Application Hosting

Apache Tomcat is an one of the open-source webserver.   Steps to install the tomcat in the Ec2-instance: 1. Need to create the ec2-instance(...

Apache Tomcat is an one of the open-source webserver.
 
Steps to install the tomcat in the Ec2-instance:

1. Need to create the ec2-instance(redhat os),

2. Install the Java,

3. Download the Tomcat package and create the link for start and stop,

5. Adding the tomcat-users, password and roles. 


Installing the Java:

Command: yum install java-1.8*

Download the Tomcat package and create the link for start and stop:

To install tomcat need to download the source code from the official tomcat documentation.

Use the below link to download the .gz or zip file from Official Tomcat documentation.
https://tomcat.apache.org/download-80.cgi
To download from Linux using the wget command, if the wget package not installed on your machine, you need to install using the below command. Command: yum install wget Now, we can download the tomcat source code inside the ec2-linux machine using below command.

Command: wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.82/bin/apache-tomcat-8.5.82.zip

Once the Compressed file downloaded we need to Unzip the compressed file using below command.

Command: unzip apache-tomcat-8.5.82.zip
Once the tomcat installed, we need to start the services. Start or Stop the services we need to execute the script already placed inside the bin directory Command : cd bin/ Inside the bin directory we have startup.sh and shutdown.sh file inside the bin directory, we need to give the execute permission for those two files by running below command.

Command:  chmod +x startup.sh

                    chmod +x shutdown.sh

                    chmod +x catalina.sh

Now we can start the script by running manually by sh startup.sh or else we can link that script as executable one, for that we need to execute the below command.


Now we can start simply using the tomcatstart command as well to stop using the tomcatstop command.
Now, we can check running status by entering the http://publicip:8080 in the browser, before that make sure to add the 8080 port inside the AWS security group’s inbound rules.


To fix the above error, you should need to edit the manager’s context.xml file.

Before editing the file need to find all the context.file by running below command.

Command:  find . -name "context.xml"

Open those context.xml files and Disable the class by adding <!-- front of the class and -->  end of the class and save the file.

Now stop and start the tomcat using the command “tomcatstop” and “tomcatstart”.

Now refreshing the browser URL it will ask you the username and password. So we need to set the roles, username and password.

Adding the tomcat-users, password and roles:

To add the username, password and roles need to change the directory to /opt/apache-tomcat-8.5.82/conf inside the conf we are able to see the file name called tomcat-users.xml. Open that file and add the below username,password and roles for the users.

  <role rolename="manager-gui"/>

  <role rolename="manager-script"/>

  <role rolename="manager-jmx"/>

  <role rolename="manager-status"/>

  <user username="admin" password="admin123" roles="manager-gui,manager-script,manager-jmx,manager-status"/>

  <user username="tomcat" password="tomcat"  roles="manager-script"/>

  <user username="techiev" password="techiev123" roles="manager-gui"/>
Once added save the file and restart the tomcat and login the using username and password.



Now we can able to see the Tomcat server up and running.

----------------------------------------!!!! Happy Learning with Techiev !!!!!!!!----------------------------------
-------------------------Subscribe our Youtube Channel by clicking the below link---------------------- ----------------------------!!https://www.youtube.com/@techieview729!!---------------------









Name

AWS,19,Devops,30,linux,11,
ltr
item
Techie View: Deploying Apache Tomcat Web Server on AWS EC2 with Red Hat OS: Step-by-Step Guide for Web Application Hosting
Deploying Apache Tomcat Web Server on AWS EC2 with Red Hat OS: Step-by-Step Guide for Web Application Hosting
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxF21Wkhe_pVJZa9mLqPvN1RCZd6E0fabthJ-p5X58iplYD3ZIbVDQj_lPoPa5577fdiCg-1o_QR4qhEQueuM6Z1dDxLr8fyb9Y1Y_9nVrPojyT7pADziyodvo7qt3sRF7ycTSUi_tpXFcWRxVjYI5iiXRdECPRtziSnAq5WTlqOVwf1oMO5qSxf7sZA/w640-h237/Tomcat-AWS-1024x380.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxF21Wkhe_pVJZa9mLqPvN1RCZd6E0fabthJ-p5X58iplYD3ZIbVDQj_lPoPa5577fdiCg-1o_QR4qhEQueuM6Z1dDxLr8fyb9Y1Y_9nVrPojyT7pADziyodvo7qt3sRF7ycTSUi_tpXFcWRxVjYI5iiXRdECPRtziSnAq5WTlqOVwf1oMO5qSxf7sZA/s72-w640-c-h237/Tomcat-AWS-1024x380.png
Techie View
https://www.techiev.com/2022/09/how-to-install-tomcat-webserver-on-aws.html
https://www.techiev.com/
https://www.techiev.com/
https://www.techiev.com/2022/09/how-to-install-tomcat-webserver-on-aws.html
true
7013663511659419322
UTF-8
Loaded All Posts Not found any posts VIEW ALL View Full Article Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy