Login to Azure portal
Create a VM,
After creating VM, add an inbound rule in VM's network port 8080.
JDK & Tomcat server deployement,
sudo apt-get update -y sudo apt install openjdk-11-jre -y #JDK installation cd /opt sudo wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.65/bin/apache-tomcat-9.0.65.tar.gz #Will download the tomcat setup from the link sudo tar -xvf apache-tomcat-9.0.65.tar.gz #extract from zip
Now, we need to change the login credentials of tomcat. Follow the below steps,
cd /opt/apache-tomcat-9.0.65/conf sudo vi tomcat-users.xml
Now we need to create links for the
startup.sh
andshutdown.sh
to the path/usr/bin/
.
Creating symbolic links tostartup.sh
in/usr/bin
simplifies starting Tomcat from any directory, enhancing user convenience.sudo ln -s /opt/apache-tomcat-9.0.65/bin/startup.sh /usr/bin/starttomcat #This links will start the tomcat server sudo ln -s /opt/apache-tomcat-9.0.65/bin/shutdown.sh /usr/bin/stopTomcat #This link will stop the tomcat server
Now we need to comment-out few commands from the below locations. To comment-out, we need to start with
<!--
and end with-->
,sudo vi /opt/apache-tomcat-9.0.65/webapps/manager/META-INF/context.xml
sudo vi /opt/apache-tomcat-9.0.65/webapps/host-manager/META-INF/context.xml
Start the tomcat server,
sudo starttomcat # to start tomcat server sudo stoptomcat # to stop tomcat server
Copy the Public IP of the VM where Tomcat server is running and paste in URL in the below format,
https://<Public_IP>:8080/
Now Click on
Manage App
in the right side below Server Status, It'll ask for username and password. Enter the Username and Password which we created and it'll then open i.e., Username - admin and Password - admin1234,This is where the application will run. To run application follow below steps,
Create
*.war/*.jar
file out ofpom.xml
using maven commands,mvn clean package (or) mvn package
To know about Maven setup click here.
After creating
*.war/*.jar
, Change the location of the file,sudo cp target/*.war /opt/apache-tomcat-9.0.65/webapps/
Now in URL, copy the public IP and write in below format.
https://<Public IP>:8080/*
Replace "*
" with appname written with.jar/.war
. And App will open.