0% found this document useful (0 votes)
27 views5 pages

Tomcat Notes

The document outlines the process of deploying an Apache web server using Jenkins, detailing four main steps: coding, building, testing, and deploying. It includes instructions for setting up Jenkins, configuring Maven, generating a WAR file, and deploying the application on a Tomcat server. The final step involves configuring Jenkins to deploy the WAR file to Tomcat, resulting in a successful web application deployment.

Uploaded by

sampath yadav
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)
27 views5 pages

Tomcat Notes

The document outlines the process of deploying an Apache web server using Jenkins, detailing four main steps: coding, building, testing, and deploying. It includes instructions for setting up Jenkins, configuring Maven, generating a WAR file, and deploying the application on a Tomcat server. The final step involves configuring Jenkins to deploy the WAR file to Tomcat, resulting in a successful web application deployment.

Uploaded by

sampath yadav
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

deploy apache web server using free style jobs

Deployment : Installing a application inside a server

(or)

Installing web application on web application server

Web Server : A web server is a computer that runs websites. It stores web server software and a
websites component files (Eg: HTML docs,images,css,js files)

S
IN
(or)

A web server is a computer system capable of delivering web content to end users over

NK
the internet via a web browser

Eg for web servers: Apache tomcat, Nginx, IBM, HTTPD, websphere , etc...,

JE
So, based on our requirements we will use the web servers
Present, we are using apache to deploy our code
For Java apps, we almost use apache web server
For react and node JS we use HTTPD (or) Nginx
LA
K KA
HI
PC
EE

Here, we have to follow 4 steps i.e., code, build, test, deploy.


ND

Step-1 : (code)

First create the jenkins setup, Create a job


SA

For github code, fork my github project. Below is my project url and username is “chiksand”

Copy the url save and build and see the output in server
Copy the url, save and build and see the output in server
Go to workspace → myproject → src → main → webapp → index.jsp
In this index.jsp file , we are having source code. This code will done by developers

Step-2 : (Build)

Here, we have to do maven setup


First install maven dependency i.e., java → yum install java-1.8.0-openjdk -y
So, here java version are not override. In linux, this is the benefit we had. We can maintain
multiple versions
So, present you want to check, which java version is running means we have command

S
update-alternatives --config java

IN
Through this command we are getting java versions “* +” symbol was there in java version
that means present that java is running
If you want to change java version, you can enter the number

NK
If you want current version just click ENTER
Second, install maven → yum install maven -y
Check the version → mvn -v

JE
LA
KA
make sure you have to get like above image means from server side you are clear
K

Go to jenkins dashboard → job → Configure → build steps → invoke top level maven target → inside
goals → clean package → save → build
HI

Now, Go to server → cd /var/lib/jenkins/workspace/Deployment → cd target → you got war file


PC

Overall, Through maven we generated a war file

Step -3 : (Test)
EE

Here, Testing we can’t do. And this testing will done by testing engineers
But previously we use maven, So testing already done through mvn test
ND

Step -4 : (Deploy)
SA

Here, This deploy will be done inside web server. For that, we have to launch a new instance. We have to
set up the Tomcat

1. Launch one normal server (t2.micro, normal-security group, 8gb volume, no key-pair)
2. Install tomcat dependency i.e., java → yum install java-1.8.0-openjdk -y
3. Go to browser → dlcdn.apache.org → tomcat/ → tomcat9/ → v9.0.78/ → bin → apache-tomcat-
9.0.78.tar.gz
4. Go to terminal → wget apache-tomcat-9.0.78.tar.gz
5. gunzip the file → tar -zxvf fileName → ll → apache-tomcat-9.0.78/
6. Start the tomcat, Go to → cd apache-tomcat-9.0.78/ → cd bin/ → ./ startup.sh
7. Default port number for tomcat is 8080
8. Open tomcat in browser i.e. publicIP:8080. and select Manager App you will get below image

S
IN
NK
Now above image is displaying tomcat is not access for us. So, read the description

JE
1. Edit the manager’s folder in context.xml file
a. cd apache-tomcat-9.0.78/ → webapps → manager → META-INF → vi context.xml
i. Here, delete 21, 22 lines i.e.., <valve ..... > save and exit
LA
2. Again try to access tomcat browser, it’s asking credentials
a. cd apache-tomcat-9.0.78/ → conf → vi tomcat-users.xml
i. Here, we need to add the credentials, we have this description in apache
KA
ii. we have to add 2 roles i.e., manager-gui, manager-script
K
HI

Perform same above steps and you can give any username and password
PC

b. So, here we changed the configuration file, we need to restart

i. Go to cd apache-tomcat-9.0.78/ → cd bin → perform commands


EE

a. ./ shutdown.sh
b. now, start the tomcat ./startup.sh
ND
SA
Now, you will get the tomcat web page. This is Tomcat Web Application Manager
Default we’re having 5 paths. So, whenever we did deploy it will comes after the manager like left
side

From Terminal end we did successfully tomcat setup

Now, Go to Jenkins → configure the job → post-build actions → we need deploy war container
plugin
we need to install the plugin. So, go to manage jenkins → plugins → available plugins → Deploy
war/ear container → select and click install without restart

S
Go to job → configure → post-build → we have deploy container → select

IN
we have options to fill. So, look into the below image and fill the options

NK
JE
LA
K KA

context path means, we have to give the application name


HI

we have to create tomcat-credentials → select add → username and password → give tomcat
username and password we did in tomcat setup. Then after give description like tomcat-credentials
PC

After done everything, save and build

Now, Refresh your tomcat page, we got “SandeepChikkala” in paths


EE
ND
SA
So, now click on /SandeepChikkala. now we can see the output/Application output

S
IN
So, we successfully Deployed the Apache Web application in Jenkins.

NK
JE
LA
K KA
HI
PC
EE
ND
SA

You might also like