How to Setup Tomcat 9 on Ubuntu 18.0.4 in AWS EC2

 

How to Setup Tomcat 9 on Ubuntu 18.0.4 in AWS EC2













What is Tomcat? 
Apache Tomcat is a free and open-source implementation of the Jakarta Servlet, Jakarta Expression Language, and WebSocket technologies. It provides a "pure Java" HTTP web server environment in which Java code can also run. Thus it is a Java web application server, although not a full JEE application server. 

Pre-requistes:
Create brand new EC2 instance first for setting up Tomcat. 
Open port 8080 in security firewall rules for EC2 instance in AWS

YouTube Demo:
>>>>>>


Tomcat Installation
 Follow the steps below to install Tomcat on your EC2 instance:

Change VM Host Name to Tomcat
sudo hostnamectl set-hostname Tomcat

Update to Latest packages
sudo apt update

Install Tomcat9
sudo apt-get install tomcat9 tomcat9-docs tomcat9-admin -y








Setting up tomcat admin app
sudo cp -r /usr/share/tomcat9-admin/* /var/lib/tomcat9/webapps/ -v

Setup tomcat user 
You will need to edit 
tomcat-users.xml to add tomcat user and assign to manager-script role.

Open the tomcat-users.xml file with the command below
sudo vi /var/lib/tomcat9/conf/tomcat-users.xml

Press i to switch to edit mode

Scroll down all the way to the end of the file,
Add the below lines in second last line above (above </tomcat-users>)

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






 

Tomcat need to be restarted for all changes to take effect
sudo systemctl restart tomcat9

Verify to ensure Tomcat is Running
sudo systemctl status tomcat9







To quit the current Screen: press q 


To Access Tomcat on the browser, enter your EC2 DNS Name followed by :8080 and press enter
(Tomcat listen on port 8080)





Awesome Work! You have just successfully install Tomcat on a server successfully!!

Happy Clouding

Comments

Popular posts from this blog

Install Ansible on Ubuntu | How to setup Ansible on Ubuntu 22.0.4 | Ansible install on Ubuntu

Setup build agent/slave VM and Integrate with Jenkins Master

Install SonaType Nexus 3 using Docker Compose