Tomcat Installation On EC2 Instance Document
Tomcat Installation On EC2 Instance Document
1. Java installation
Yum http://13.58.116.34:8080/ install java-1.8.0 -y
2. Jenkins installation
sudo yum install Jenkins
3. Maven installation
git clone https://github.com/mkyong/maven-examples
# mvn archetype:generate
cd java-web-project
export PATH=/opt/apache-maven-3.8.5/bin:$PATH
<modelVersion>4.0.0</modelVersion>
<groupId>com.mkyong.web</groupId>
<artifactId>java-web-project</artifactId>
<version>java-web-project</version>
<packagingg>jar</packaging>
<name>java-web-project</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncodin
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.source>${java.version}</maven.compiler.source>
<java.version>1.8</java.version>
<spring-boot.version>2.2.2.RELEASE</spring-boot.version>
<start-class>java-web-project.App</start-class>
<graal.version>19.2.1</graal.version>
</properties>
<dependencies>
<dependency>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
<version>${graal.ver
(or)
We can get the pom.xml file Directly from the developer in real time work (By using fork)
8.
Note: Make sure that we have Tomcat server is up and running
9. Go to the post build – give Required credentials and tomcat version
10. Go to that job and build now
11. Go to the workspace and console output
cd /var/lib/jenkins/workspace/hello-world/webapp/src/main/webapp/index.jsp
12. Go to the manage Jenkins – configure – build triggers – select poll scm - given the timings (It
will trigger automatically when you change the code it will trigger at schedule time) – apply
and save
# java-open jdk-y
# cd /opt
wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.64/bin/apache-
tomcat-9.0.64.tar.gz
Un zip the file tar xvzf apache-tomcat-9.0.64.tar.gz
2. mv apache-tomcat-9.0.64 tomcat
3. give executing permissions to startup.sh and shutdown.sh which are
under bin.
Check point :
http://<Public_IP>:8080
cd /opt/tomcat/conf
# update port number in the "connecter port" field in server.xml
# restart tomcat after configuration update
# tomcatdown
# tomcatup
Check point :
http://<Public_IP>:8090
17. Restart serivce and try to login to tomcat application from the
browser. This time it should be Successful
18. Go to the Jenkins dashboard – manage Jenkins – select
credentials – select Jenkins (global credentials) – add credentials –
give user name - tomcat passwd – s3cret ( refer point no 16) - save
19. Now we go to the Jenkins dashboard and select job – give to
the post build – select container like tomcat 9 – give tomcat ip –
select credentials – apply & save
20. Go to the job and build now – check once in output (in
terminal only you check the output in cd
/workspace/webapp/main/src/webapp/index.jsp)
21. Go to the same job – configure- in build section you give
polyscm (give the timing like */2 * * * *) It will trigger automatically
every 2 min after anything you changes in the file
22. Now you go & check it in the tomcat server – manage app – it
will show the output of the project