Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added GIT DOCUMENT.docx
Binary file not shown.
Binary file added GIT DOCUMENT.pdf
Binary file not shown.
71 changes: 71 additions & 0 deletions tomcat assignment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
shell script to install git and maven using git bash and ec2 instance
#!/bin/bash
#update binaries
sudo apt-get update -y

#git installation
sudo apt-get install git -y

#maven installation
sudo apt-get install maven -y
----------------------------------------------

#tomcat installation
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
--------------------------------------------------------------------------

#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='<role rolename="admin"/>
<role rolename="manager"/>
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<user username="admin" password="1234" roles="admin,manager,admin-gui,manager-gui"/>
</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 '/Manager/s/^/-->/g' -i /home/ubuntu/tomcat/webapps/manager/META-INF/context.xml
sed -e '/valve/s/^/<!--/g' -i /home/ubuntu/tomcat/webapps/host-manager/META-INF/context.xml


echo " "
echo " "
echo "Deployed artifacts in web server"
ls /home/ubuntu/tomcat/webapps/

echo " "
echo "tomcat version:"
sh /home/ubuntu/tomcat/bin/version.sh | tail -8 |head -1
echo " "
echo "java version"
java --version |head -1
echo " "
echo "git version"
git --version
echo " "
echo "maven version"
mvn --version | head -1
echo " "
echo ""
pub=`curl ifconfig.me`
echo ""
echo "Tomcat URL"
echo "http://$pub:8080"
echo " "