Command To Install Jenkins In Windows

1 view
Skip to first unread message

Cora Devries

unread,
Aug 5, 2024, 11:16:18 AM8/5/24
to nyobarpatha
Ifound this page -installation-guideto install it manually but that sounds like re-invented the wheel whenthe jar can do it. Plus there is a risk the WinSW.exe is different anddoesn't get updated by the plugin (I saw some automatic update code in it).

There is no actual way to download the exe from Jenkins directly, the slave.jar gets it from the master via the remoting protocol. I have created a request to be able to download it via an URL (as suggested by the developer), so it might be available in the future.


I don't use jenkins-slave.exe, but instead a custom script in which I can control the exact environment variable I want to set for the Jenkins slave, when launching java -jar slave.jar with the secret key you can see in the Jenkins master node page for that new slave.


To fully automate the declaration-side of slaves, use the web API to create the slave, and a groovy script to retrieve the Jenkins node/slave secret JnlpMac key.

See this script for the creation.

And the groovy script (with Jenkins 2.46 or newer) to get the secret key:


follow their installation, but you should update the xml with your desired configuration, be sure to remove all " in pathes within the xml and disable websockets in the jenkins master configuration page of the agent:


Use the option delayed Auto start, to ensure all the network services are started, that jenkins connect can not fail.And i recommend to use a registry key to give the service more time to start:Insert registry-key to give services more time to start:


The Jenkins Web application ARchive (WAR) file bundles Winstone,a Jetty servlet container wrapper,and can be started on any operating system or platform with a version of Java supported by Jenkins.See the Java Requirements page for details.


You can change the port by specifying the --httpPort option when you run thejava -jar jenkins.war command. For example, to make Jenkins accessiblethrough port 9090, then run Jenkins using the command:

java -jar jenkins.war --httpPort=9090


You can change the directory where Jenkins stores its configuration with the JENKINS_HOME environment variable.For example, to place the Jenkins configuration files in a subdirectory named my-jenkins-config, define JENKINS_HOME=my-jenkins-config before running the java -jar jenkins.war command.Use the Windows commands:


If you are running Jenkins in Docker using the official jenkins/jenkins image you can use sudo docker exec $CONTAINER_ID or CONTAINER_NAME cat /var/jenkins_home/secrets/initialAdminPassword to print the password in the console without having to exec into the container.




The simplest way to install Jenkins on Windows is to use the Jenkins Windows installer.That program will install Jenkins as a service using a 64 bit JVM chosen by the user.Keep in mind that to run Jenkins as a service, the account that runs Jenkins must have permission to login as a service.


Refer to the Windows section of theDownloading Jenkins pageto download either an LTS release or a weekly release of the Windows installer.After the download completes, open the Windows installer and follow the steps below to install Jenkins.


When Installing Jenkins, it is recommended to install and run Jenkins as an independentwindows service using a local or domain user as it is much safer than running Jenkinsusing LocalSystem(Windows equivalent of root) which will grant Jenkins full accessto your machine and services.


To run Jenkins service using a local or domain user, specify the domain user name andpassword with which you want to run Jenkins,click on Test Credentials to test your domain credentials and click on Next.


Specify the port on which Jenkins will be running,Test Port button to validate whether the specified port if free on your machine or not.Consequently, if the port is free, it will show a green tick mark as shown below,then click on Next.


The installation process checks for Java on your machine and prefills the dialog with theJava home directory.If the needed Java version is not installed on your machine, you will be prompted to install it.


MSI installers can be installed via a silent method, which can show basic UI (/qb) or no UI at all (/qn). The silent method does not prompt for user input so there are properties that you can pass to the installer to set the specific values. A very basic command line is shown below for a silent install.


When installing a service to run under a domain user account, the account must have the right to logon as a service. This logon permission applies strictly to the local computer and must be granted in the Local Security Policy.


NOTE: if you installed Jenkins using the windows installer, you shouldn't need to do anything else here because the windows installer automatically runs Jenkins as a windows service.


NOTE: The "Install as Windows Service" link indicated above will not appear if Jenkins is already running as a service on the machine. You can verifying that Jenkins is running as a service by launching the Services app from the Windows Start Menu and looking for a running service called "jenkins" among the list of all windows services running on the machine.


Choose the directory where Jenkins shall be installed (directory must already exist. If not create it before hand). This will become JENKINS_HOME and used to store data files and programs alike.

Upon successful completion of the installation, you should see a page asking you to restart Jenkins.


When you click "OK", the slave agent window will terminate. The new slave agent runs as a service without showing a window, so head over to the service manager from the control panel and confirm that the slave agent is indeed running as a service:


On the Jenkins install directory, grant All Privileges to the Jenkins domain user. You may have to delete all old LOG files, hudson-slave.err, hudson-slave.out, hudson-slave.wrapper and redirect for the service to start back up.


Note that one space after the "=" for each option is mandatory.

Also note that this will not assign a description string to the service. This can be added by creating a new String value called Description in the registry, under


If you are having trouble getting the Java Web Start agent installed as a Windows service an alternative method of starting the service automatically when Windows starts is to use the Windows Scheduler.


The JVM launch parameters of these Windows services are controlled by an XML file jenkins.xml and jenkins-slave.xml respectively. These files can be found in $JENKINS_HOME and in the slave root directory respectively, after you've install them as Windows services.


Hi,

I had installed newman using the npm in command prompt. I wanted to execute the collections using Jenkins, so I tried using the newman command and I got an error during the build saying newman not found. I tried giving the path as shown in the image.

image1187315 17.8 KB


I hope this helps someone out there and makes it a bit easier for you to set up a Jenkins machine or slave on a Windows machine. Because Jenkins is written in Java you can run it on most environments and because of the way it works you can do Continuous Integration against any code base.


i have installed jenkins on top of tomcat, and it is available in subdrectory JENKINS. by following steps I always get a message like URL was not found. I was thinking about relative paths. playing with it I get: java.io.FileNotFoundException: ..I got same message even by changing in jnlp to this


iam very new to the jenkins but this is very flexible to read and understand and i tried and i succeeded in installing the jenkins.i dont have a tomcat in my local machine but still it is running . i dont have a clarity on that can u please give me the clarity on how its getting execute.


SaranReddy :

iam very new to the jenkins but this is very flexible to read and understand and i tried and i succeeded in installing the jenkins.i dont have a tomcat in my local machine but still it is running .(if we want execute any app on browser at least webserver is required ) but here is no webserver.how it is getting execute? can anybody give me the clarity


when the little window appears saying it is connected, I found if I ever close it, my Jenkins server cannot see the slave. I tried setting up the windows service, but it did not work (and I have not investigated why (yet)).


Thanks! This was a great tutorial.

One note to make would be that you dont need to install Jenkins on the slave computer.

I also found that when wanting to start the slave, you dont need to save the slave-agent file back on the master. Just run the jawaws command from the slave and it will work as desired.


I am in the process of configuring jenkins on server. There is no Java installed on server.From the link, I understood that Jenkins windows installer will install JRE so that no need of external java installation.jenkins windows installerBut when I ran the command java-version it returns error that no java installed. So it required to install java seperately? Is it needed for jenkins to run java on the server?


You need Java installed because Jenkins generally works from a tomcat server and installing tomcat requires java. If you are in windows, then you need to set the correct PATH variables as well - JAVA_HOME variable to be specific and also add the bin folder to the PATH


The traditional Jenkins installation method is to use the installers available on the Jenkins website, or through your local operating system's package manager. The installation process is generally simple, but there are a few tricks to be aware of.


If you prefer stability and don't require all the latest features right away, go with an LTS release. If you want the latest features as soon as possible and don't mind the occasional glitch, go with the weekly releases.

3a8082e126
Reply all
Reply to author
Forward
0 new messages