This Tutorial Explains How to Download and Install Jenkins. You will Also Learn Steps for Running Jenkins as a Standalone Application, in Docker, as Windows Service, etc:
In our previous tutorial, we have covered topics related to Agile development, Continuous Integration, typical setup of CI, Jenkins Continuous Integration, features of Jenkins, and running Jenkins.
In this tutorial, we will learn various ways of installing and running Jenkins. We will also see the steps for running Jenkins as a standalone application, as a windows service, running Jenkins in Docker, etc.
=> Visit Here To See The Jenkins Training Series For All
Table of Contents:
Video Tutorial: Download, Install & Run Jenkins
Here is a video tutorial:
Jenkins Download And Install
There are various applications that can be installed based on the way the Jenkins has to
run.
Some of the methods are as follows:
Method #1:
Step 1: Download the Generic Java package, that is, jenkins.war file from Jenkins, if Jenkins has to run as a standalone application or run on an application server.
Figure 1: Generic Java package location
The above figure shows the location of the Generic Java package in Jenkins downloads
Step 2: Click on the link shown in Figure 1. This will save the jenkins.war file in the default downloads folder location as shown in Figure 2 below.
Method #2:
If Jenkins has to run in Docker then we need to install the following:
#1) Install the Docker toolbox, if the operating system is windows7.
Figure 3: Docker toolbox location
The above figure points to the location from where the docker toolbox can be downloaded.
#2) After downloading the Docker toolbox, Run the application. The run dialog will pop up as shown in Figure 4 below.
#3) In the next step, the Docker setup wizard opens to select the components such as Kinematic, Git, and VirtualBox as shown in Figure 5 below.
#4) Select Additional Tasks dialog box appears as the next step in the setup, as shown in Figure 6 below. Also, enable VirtualBox in the dialog.
Figure 6: Select Additional Tasks dialog
#5) After the completion of settings, Ready to Install dialog appears as shown in Figure7 below.
Figure 7: Ready to Install dialog
#6) Finally, the setup is completed as shown in Figure 8 below.
#7) The below figure is the Jenkins image for the Docker. This can anyway be downloaded by using the pull command or from the Kinematics. This will be discussed later.
Figure 9: Jenkins image in Kinematics
Running Jenkins
#1) As A Standalone Application
Follow the steps mentioned below to run the Jenkins as a standalone application:
Step 1: After downloading the Java Generic Package, as explained above, launch the command prompt as administrator and type Java –jar jenkins.war as shown in Figure 10 below.
Figure 10: Running jenkins.war from the command prompt
Step 2: After running the Jenkins file, a random password will be generated which needs to be entered on running Jenkins as a standalone application, i.e. launching Jenkins using http://localhost:8080 as shown in Figure 11 below.
Figure 11: Admin password screen
Step 3: After this step, a screen pops up to select the plugins to be integrated with the Jenkins server. This is shown in Figure 12 below.
Figure 12: To select the plugins to be installed
Step 4: After the above step, we need to create the first admin user as shown in Figure 13 below.
Figure 13: Creating the first admin user
Step 5: Finally the Jenkins dashboard screen is displayed as shown in Figure 14 below. This means that Jenkins is running as a standalone application.
#2) Running Jenkins In Docker
To run Jenkins in Docker in the Windows 7 operating system, we need to follow the following steps:
Step 1: After downloading the Docker toolbox as explained above in Figure 3, run the docker quickstart terminal as shown below and type docker pull jenkins\jenkins to get the latest Jenkins image and wait till the admin password is displayed and Jenkins is fully up and running as shown in Figure 15.
Figure 15: Jenkins image installed and fully running.
Step 2: The IP address in which the Jenkins image is running can be found in the settings section as shown in Figure 16 below.
Figure 16: Docker Hostname and port
Step 3: Host the address using Http to see the Jenkins initial setup screen as shown in Figure 17 below.
Figure 17: Admin password screen in docker
Step 4: The next screen that comes is Install plugins, as shown in Figure 18.
Figure 18: Install Plugins screen
Step 5: After installing the desired plugins, the Jenkins dashboard appears as shown in Figure 19 below.
Figure 19: Jenkins dashboard screen in docker
#3) In An Application Server
After downloading the jenkins.war as explained above, we need to follow the steps below:
Step 1: Place the jenkins.war file in the webapps folder of the tomcat server as shown in Figure 20 below.
Figure 20: jenkins.war file placed in the webapps folder
Step 2: Run the tomcat server by using a startup.bat file in the bin folder as administrator. Wait till Jenkins is fully up and running as shown in Figure 21 below.
Figure 21: Jenkins is fully up and running screen
Step 3: Launch the Jenkins using http:\\localhost:8080\jenkins as shown in Figure 22 below.
Figure 22: Jenkins Dashboard in tomcat
#4) As A Windows Service
Step 1: Run the Jenkins with one of the above methods. Here we will launch as a standalone application.
Step 2: Click on manage Jenkins on the Jenkins dashboard as shown in Figure 23 below.
Figure 23:Manage Jenkins link on Jenkins dashboard
Step 3: Click on Install as a Windows Service option as shown in Figure 24 below.
Figure 24: Install as Windows Service link
Step 4: Select the desired installation directory as shown in Figure 25. Here we are using the default directory itself.
Figure 25: Selecting the installation directory
Step 5: After the installation is complete, Jenkins will restart and also, we can see that Jenkins is started as windows service in services.msc as shown in Figure 26.
Figure 26: Jenkins as a service
Conclusion
In this tutorial, we have learned about downloading and installing Jenkins, Running Jenkins as a standalone application, Running Jenkins in the Docker container, Running Jenkins in an application server as well as Running Jenkins as windows service.
In the next tutorial, we will be learning about Jenkins Job, creating different types of jobs, building triggers, configuring source code management, and Maven build steps.
=> Check ALL Jenkins Tutorials Here