Saturday, December 31, 2022

How to Install Tomcat on Ubuntu Ec2

How to Install Tomcat on Ubuntu Ec2  


Java Setup on Ubuntu


sudo apt update


Install Java Open JDK 8 package

sudo apt-get install default-jdk -y



Once install java, enter the below command


Verify Java Version

java -version

 

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

Now lets do Jenkins installation



Tomcat Installation

Tomcat is a web server or web container where java web application can be deployed by developers.

sudo apt-get update

sudo apt-get install tomcat9 -y



sudo apt-get install tomcat9-docs tomcat9-examples tomcat9-admin -y


 

 

sudo cp -r /usr/share/tomcat9-admin/* /var/lib/tomcat9/webapps/ -v


 

setup an user in tomcat 

sudo vi /var/lib/tomcat9/conf/tomcat-users.xml


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-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="password" roles="manager-gui,manager-script"/>



 


Use :wq! to Save and exit the file


 

sudo systemctl restart tomcat9

sudo systemctl status tomcat9



 

 

you may get message that says tomcat is active running.

press q for quitting from that window.

Now go to browser, copy public DNS
http://Ec2_public_dns_name:8080
  Note: Open port 8080 in AWS for this to work follow the steps on 
Next Make Sure Port 8080 is Open above

You should see a page that says.
It works!!!!



That's it. You have setup  Tomcat successfully!!






No comments:

Post a Comment

How to Deploy to Kubernetes using Argo CD and GitOps

  How to Deploy to Kubernetes using Argo CD and GitOps Using Kubernetes to deploy your application can provide significant infrastructural a...