How to Run/Install Jenkins on Apache Tomcat Server

Best definition of Jenkins I found at official Jenkins Doc :-

Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.

Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.

Jenkins is typically run as a standalone application in its own process with the built-in Java servlet container/application server (Jetty). Jenkins can also be run as a servlet in different Java servlet containers such as Apache Tomcat or GlassFish.

In this post, we will learn installing Jenkins on Apache Tomcat Server step by step.

Step 1 :- Download Java 8 or 11 as Jenkins supports that.

Installing Java should not be problem. Visit JDK Download web page and download as per your operating system and processor. DO NOT FORGET to set JAVA_HOME path in your system as Environment variables. If you face any issue in installing Java and setting up path, let me know in comments or send me a mail.

Verify Java installation:-

Verify JAVA_HOME path setup:-

Step 2 :- Download Apace Tomcat Server

Navigate to Apache Tomcat Server Website and select latest version. I will install Tomcat 9 as Tomcat 10 is an Alpha version.

Click on Tomcat 9 ( In my case) and go to Binary Distribution section and download appropriate as per your OS and processor. I will download for 64 bit Windows.

It will download a ZIP (Compressed file) and I hope you must know how can you unzip or extract a ZIP file.

Step 3 – Download Jenkins.war file

Navigate to Jenkins Download page and download LTS – Jenkins WAR file as shown below:-

Step 4:- Copy jenkins.war file in webapps folder of Apache Tomcat Server

Copy jenkins.war file and go to extracted Apache tomcat folder. There you will find a folder named “webapps”.

Copied jenkins.war file.

Step 5:- Start Apache Tomcat Server

Navigate to bin folder of Apache Tomcat Server. There you will find two window batch files:-

  1. startup – To start tomcat server. By default it starts at 8080 port.
  2. shutdown – To shutdown running tomcat server

Note – To start tomcat server on other port, go to conf folder in Apache tomcat folder. You will find a server.xml file. Change port to whatever you want. This is optional step.

To start tomcat server, click on “startup” window batch file. It will open command prompt and start server. Notice that it will deploy war file as well.

Since Jenkins is being installed first time, it will show that Jenkins initial setup is required and will generate an initial password which is required to unlock jenkins. No need to copy as it will be in jenkins installation file directory as well. Path will be provided in console.

Now if you go to webapps folder, you will see a “jenkins” folder is created.

Step 6 – Hit Tomcat URL

Apache tomcat will start at 8080 by default. We have not changed any port so type “localhost:8080” in a web browser. You will see below page and a message on successful installation of Tomcat.

Step 7 :- Launch Jenkins from Apache URL

To access jenkins, just append /jenkins in above URL. You will be asked to unlock Jenkins by providing an initial admin password which is shown in Step 5 . You can copy it from file location to paste here. Submit password and click on Continue.

Step 8:- Install plugins

It will ask you to Customize jenkins by installing a good number of plugins. You can manually choose or install all suggested plugins. I will recommend to go for “Install suggested plugins“.

Plugin installation will take time. Let it be completed. Now it will ask you to create first admin user. You can skip it but better to create and click on “Save and Continue” button.

Now it will ask you to configure Jenkins URL. If you are on network, you need to change it so that you can access from other machine as well. Let’s not to worry about that and click on “Save and Finish” button.

You are done now. Click on “Start using Jenkins“.

You are at Jenkins Dashboard now.

Shutdown running Tomcat server

To stop tomcat server, click on “shutdown” window batch file in bin folder of Apache tomcat. It will close the tomcat server cmd and shutdown tomcat server.

If you refresh jenkins url , it will show “This site can not be reached”.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyLearning

You can find all Selenium related post here.
You can find all API manual and automation related posts here.
You can find frequently asked Java Programs here.

Leave a Reply

Your email address will not be published. Required fields are marked *