How to install Jenkins CI on Windows

Developers may automate the creation, testing, and deployment of apps using Jenkins, an open-source automation server. It can be used with several operating systems, including Windows, Linux, Unix, and macOS. Let's look at each step of installing Jenkins on Windows 10 and 11.

Prerequisites

  • A computer with Windows 10 or 11

  • The most recent version of Java runtime environment or Java Development Kit

  • Access to an account with administrator privileges

Steps to install Jenkins CI on Windows

Before we proceed, let's assume we have either JDE/JRE installed on our local machine.

Step 1: Download Jenkins

Go to the Jenkins Download Page and download Jenkins for “Windows”.

As we can see, two packages are available for download, the LTS (stable) version and the regular releases. The LTS version is recommended for end users, while the regular is provided for developers. Then proceed and click on windows; your download should begin immediately.

Step 2: Local setup

Run the installation file jenkins.msi after the download is finished. The setup wizard starts. We'll see a dialog box similar to this. Then, click Next to proceed.

Step 3: Select the destination folder

Click the Next button to proceed after selecting the location for Jenkins installation.

Step 4: Service login credentials

If we use the "Run service as LocalSystem (not recommended)" option, this login type would not require an account and password. It is unsuitable for production and can only be used for local development. However, with the "Run service as a local or domain user" option, we must input an administrator account on our Windows system and its respective password.

Note: It should be noted that the account referred to here is our Windows account. It must be an administrative account and not the standard type.

If we get this error message: "This account either does not have the privilege to log in as a service or the account was unable to be verified, " proceed with the steps below or skip to step 5.

When installing a service to run under it, the domain user account must be able to log in as a service. This login permission only applies to the present machine and needs to be enabled in the local security policy. Update the local security policy in the manner shown below to declare the "login as a service" permission on the device:

  • Stage 1: Sign in with administrator rights to the computer.

  • Stage 2: Open the "Administrative Tools" tab (called "Windows Tools" if using Windows 11) and the "Local Security Policy." If we do not see local security tools on our system, we do not have them. Then we've to download and configure it before we can progress. If it's installed, kindly skip to stage 3.

Download SecPol.msc script on the Windows 11 PC. (The link to download GPEdit Enabler for Windows 11)

To extract the contents, right-click the compressed folder.

Now, use the "File Explorer" tab to find the extracted folder. Then, choose "Run" as administrator from the context menu when we right-click on the.bat file.

Click Yes, when getting a prompt to allow access.

The file will begin installing. Please be patient until the procedure is finished. When it is, we'll be asked to click on any key.

The group policy editor and security policy manager have been successfully installed on the Windows 11 computer. By pressing "Windows + R" (a dialog box ought to appear), we can launch the local security policy editor by typing "secpol.msc," as seen below.

  • Stage 3: Click the User Rights Assignment button under Local Policy after expanding it.

  • Stage 4: Click Log on as a service in the right pane, then select properties from the context menu.

  • Stage 5: Select Add User or Group to add a new user.

  • Stage 6: Type the user's name into the Select Users or Groups dialogue box, locate the user, and click OK.

  • Stage 7: In the Log on as a service Properties window, click OK to save the modifications. Then try it later with the new user.

Step 5: Port selection

The port that we want Jenkins to run on should be entered. Click the Test Port to see if the chosen port is open, then click Next to proceed.

Suppose we get the error shown below. It means we've used the port number elsewhere. Hence, we'll need to choose another number.

Let's assume we chose another number, and it went through. We would know it has gone through when we get the green tick shown below:

Step 6: Select the Java home directory

The installation looks for Java on our machine and populates the Java home directory dialog. We'll be prompted to do so if the necessary Java version is not installed on our computer.

Click Next to proceed once our Java home directory has been chosen.

Step 7: Select the features

Adding some add-ons to your installation
Adding some add-ons to your installation

Choosing the firewall exception is not advisable, as we permit any connection to our JVM. This means both permitted users and non-permitted users can have access to it. For security, this would be a problem.

Firewall exception feature
Firewall exception feature

Hence, for our setup installation, we'll include the firewall and start the service. After making this selection, click the Next button, and our installation should begin.

Step 8: Installation

Wait for the program to finish installing.

Conclusion

Congratulations! We've gotten Jenkins running as a service on our windows device. To confirm, kindly navigate to services by typing services in the windows search bar, and we'll see Jenkins running as follows:

Free Resources