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.
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:
>>>>>>
YouTube Demo:
>>>>>>
Tomcat Installation
Update to Latest packages
sudo apt update
Install Tomcat9
sudo apt-get install tomcat9 tomcat9-docs tomcat9-admin -y
Setting up tomcat admin app
Press i to switch to edit mode
Tomcat need to be restarted for all changes to take effectsudo systemctl restart tomcat9
Verify to ensure Tomcat is Running
Follow the steps below to install Tomcat on your EC2 instance:
Change VM Host Name to Tomcat
sudo hostnamectl set-hostname Tomcat
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.
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
sudo vi /var/lib/tomcat9/conf/tomcat-
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"/>
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
Post a Comment