Published July 01, 2018 by

Install Jenkins on Tomcat in Windows or Linux

CI or Continuous integration is being adopted at a very high pace to streamline the build time & testing. To implement the CI, there are many tools available but the Jenkins lead the pack.

In this tutorial, we will learn to install Jenkins on Tomcat server.

Pre-requisites

1- We need to have Java installed on our machine. install java on CentOS/RHEL & on Ubuntu.

2- We will also to have Apache Tomcat installed on our system. Install Tomcat.


Install Jenkins on Tomcat

Now that we have all completed the above-mentioned steps, we will now download the 'jenkins.war' file from the official Jenkins Web page. Execute the following command from a terminal to download the 'jenkins.war'

# wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war

Now we need to copy this file to webapps directory located in Tomcat home. So if you have tomcat installed in opt directory, then run the following command.

# cp -rv jenkins.war /opt/tomcat/webapps

With this step, a process to install Jenkins on tomcat is now complete. All we have to do is to start the tomcat server. Start the tomcat server.

# sh /opt/tomcat/bin/startup.sh

After the server has been started, check if the Jenkins is working by visiting the following URL from the browser.

http://server_ip:8080/jenkins

We will have to configure the Jenkins server now. As mentioned on the webpage, we can find the admin password from location /root/.jenkins/secrets/initialAdminPassword. Get the password with the following command.

# cat /root/.jenkins/secrets/initialAdminPassword


Copy it to the webpage and press Continue.

Here it asks for install plugins please select whatever you want. 

Now complete the setup by filling out the required details. After the setup is complete, we can access jenkins and can also create new jobs on the jenkins server.