How to install Jenkins on Tomcat : Complete Guide
CI or Continuous integration is being adopted at very high pace to streamline the buid time & testing. To implement the CI, there are many tools available but the jenkins lead the pack. We have already learned to install Jenkins on CentOS server.
In this tutorial, we will learn to install Jenkins on Tomcat server. So let’s start with the process….
(Recommended Read: How to install Apache Maven on CentOS (& other Linux distros))
1- We need to have Java installed on our Linux machine. We can do so using the default package manager, i.e.
$ sudo yum install java-1.8.0
$ sudo apt-get install openjdk-8*
2- We will also will to have Apache Tomcat installed on our system. For installing Apache Tomcat, please refer to out detailed guide “Installing Apache tomcat on Linux”.
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 Webpage. Execute the following command from terminal to download the ‘jenkins.war’ ,
$ wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
Note:- If you have jenkins installed already, you can also use the ‘jenkins.war ’ from that installation. For already installed jenkins, jenkins.war can be located at ‘/usr/share/jenkins/jenkins.war’.
Now we need to copy this file to webapps directory located in Tomcat home. So if you have tomcat installed in home directory, than run the following command,
$ cp -rv jenkins.war ~/apache-tomcat-8.5.29/webapps
With this step, process to install jenkins on tomcat is now complete. All we have to do is to start the tomcat server. Start the tomcat server,
$ cd ~/apache-tomcat-8.5.29/bin
$ sh startup.sh
After the server has been started, check if the tomcat is working by visting the following URL from the browser,
Our tomcat server is up. To start using the jenkins, visit the following URL,
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 command,
$ cat /root/.jenkins/secrets/initialAdminPassword
& copy it to the webpage & press next. Now complete the setup by filling out the required details. After the setup is complete, we can access jenkins & can also create new jobs on the jenkins server.
With this we end our tutorial on how to install Jenkins on Tomcat. Please do let us know if you are facing any issues or have any query using the comment box below.