0% found this document useful (0 votes)
14 views6 pages

Deploy Application Using WAR File On Jenkins

This document outlines the steps to deploy an application using Jenkins on AWS. It includes launching EC2 instances, installing Java and Maven, setting up Jenkins, creating a job to build the application, and deploying the WAR file to Apache Tomcat. The process involves configuring various tools and settings to ensure successful deployment.

Uploaded by

Ruthvik K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Deploy Application Using WAR File On Jenkins

This document outlines the steps to deploy an application using Jenkins on AWS. It includes launching EC2 instances, installing Java and Maven, setting up Jenkins, creating a job to build the application, and deploying the WAR file to Apache Tomcat. The process involves configuring various tools and settings to ensure successful deployment.

Uploaded by

Ruthvik K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

How To Deploy Application Using

Jenkins
Step-1: Launch an Ec2 instance using AWS
Add a name & choose Ami
Choose an instance type T2-micro
Add a key pair
Configure a security group
Configure storage
launch instance.
Step-2: Connect to AWS Console and install dependencies to configure jenkins.
Install java 21:
sudo rpm --import https://yum.corretto.aws/corretto.key
sudo curl -Lo /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
sudo yum install -y java-21-amazon-corretto-devel
java -version
Note: sudo alternatives --config java.
Step-3: Go to /opt and download Maven. It is dependency to Compile,Test & Install the Code.
cd /opt
sudo curl -O https://downloads.apache.org/maven/maven-3/3.9.6/binaries/apache-
maven-3.9.6-bin.tar.gz
Extract and rename for simplicity
sudo tar -xvzf apache-maven-3.9.6-bin.tar.gz
sudo mv apache-maven-3.9.6 /opt/maven
Set up environment variables
sudo tee /etc/profile.d/maven.sh > /dev/null <<EOF
export M2_HOME=/opt/maven
export PATH=\$M2_HOME/bin:\$PATH
EOF
Make it executable and reload profile
sudo chmod +x /etc/profile.d/maven.sh
source /etc/profile.d/maven.sh
Step-4: Setup jenkins in the same instance using jenkins.io repo.
sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
sudo yum upgrade
Add required dependencies for the jenkins package
sudo yum install fontconfig java-21-openjdk
sudo yum install jenkins
sudo systemctl daemon-reload
sudo systemctl start jenkins
sudo systemctl status jenkins
Step-5:Access Jenkins
Open a web browser and navigate to http://your_server_ip_or_domain:8080. Follow the
on screen instructions to complete the setup.

Step-6: Navigate to: Manage Jenkins → Global Tool Configuration


Under Maven: Click Add Maven
Set name: Maven 3.9.6
Uncheck Install Automatically
Set MAVEN_HOME: /opt/maven
Save configuration
Create a Job
Step-7: Create a Job in Jenkins
Create a new Freestyle or Pipeline job.
General → GitHub Project →(add git repo url).
Source code managment →(add same git repo url).
In Build Steps →Invoke top level managment targets
check Use Maven Version → select Maven 3.9.6.
Use Maven goals like:
1. clean install
2. clean package
Note: We get WAR File in target folder.

Build the Job →you get job Success. (If not check the pom.xml plugins )
Eg:Output of the job

Step-8: Launch an another Ec2 instance using AWS for setup Tomcat
Add a name & choose Ami
Choose an instance type T2-micro
Add a key pair
Configure a security group
Configure storage
launch instance.
Step-9: Install java
sudo yum install java -y
Step 10: Download and Install Apache Tomcat Download Tomcat:
Navigate to the https://downloads.apache.org/tomcat/tomcat-9/v9.0.104/bin/ to find
the latest version.
Download the binary distribution for your system.
wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.104/bin/apache-tomcat
9.0.104.tar.gz
Note: Copy the link of tar.gz file only.
Extract the Archive: tar -xvf apache-tomcat-9.0.104.tar.gz
STEP-11: Access Tomcat Open a web browser and navigate to
http://your_server_ip_or_domain:8080. Follow the on screen instructions to complete the
setup
After Setting up the Tomcat :
Navigate to jenkins
Go to Manage Jenkins → Install plugin called Deploy Container
Configure the Post build Actions Select Deploy war/ear to a container
1. WAR/EAR Files: target/*.war
2. Context path: ( name of application)
Add Tomcat Credentials and give Tomact url.
Eg:

Save it.
And trigger the job.
WAR file is deployed in Tomcat Application using jenkins .
Eg: (Given with name called phone-app)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy