From ac283bc51ab28e0f8ad53b6fa8a99e39ae7f2993 Mon Sep 17 00:00:00 2001 From: kolliaaditya <105494481+kolliaaditya@users.noreply.github.com> Date: Tue, 6 Aug 2024 07:34:43 +0530 Subject: [PATCH] Create Aditya tomcat deployment --- Aditya tom | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Aditya tom diff --git a/Aditya tom b/Aditya tom new file mode 100644 index 0000000..9ba558c --- /dev/null +++ b/Aditya tom @@ -0,0 +1,81 @@ +#!/bin/bash + +#update binaries +sudo apt-get update -y + +#git installation +sudo apt-get install git +git init + +#java installation +sudo apt install default-jdk -y + +#maven installation +sudo apt-get install maven -y + + +#tomcat installation +#download tomcat from internet use wget +wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.91/bin/apache-tomcat-9.0.91.tar.gz +#Unzip the downloaded file +tar -xvzf apache-tomcat-9.0.91.tar.gz +#After unzip delete unzip file +rm -rf apache-tomcat-9.0.91.tar.gz +#Now move the directory name to tomcat +mv apache-tomcat-9.0.91 tomcat +#Go to bin directory inside the tomcat and execute startup.sh +sh tomcat/bin/startup.sh + +#clone source code to lacal repo +git clone https://github.com/sunilb66/java-hello-world-with-maven + +cd /home/ubuntu/java-hello-world-with-maven + +#create artifacts and deploy in web server +mvn clean install +cd target +cp /home/ubuntu/java-hello-world-with-maven/target/jb-hello-world-maven-0.2.0.jar /home/ubuntu/tomcat/webapps/ +cp /home/ubuntu/Calendar.war /home/ubuntu/tomcat/webapps/ + +#added users in tomcat +users=' + + + + + +' + +sed -i '/tomcat-users>/d' /home/ubuntu/tomcat/conf/tomcat-users.xml +echo "$users" >> /home/ubuntu/tomcat/conf/tomcat-users.xml + +#modify restrictions +sed -e '/valve/s/^//g' -i /home/ubuntu/tomcat/webapps/manager/META-INF/context.xml +sed -e '/valve/s/^/