For understanding and installing refer previous blog of Jenkins Server.
For adding a node as a slave to Jenkins master, follow following steps.
Step 1: On Jenkins master go to
Manage Jenkins > Manage Nodes.
Step 2: Select
New Node and enter node name.
Step 3: select
Permanent Agent -> Press OK.
Step 4: On the next page, fill in the following fields:
- Set a number of executors (one or more) as needed. Default is 1.
- Set a Remote FS Root, a home directory for the master on the slave machine. i.e Linux Slave: “/opt/jenkins/” or Windows Slave: “E:/jenkins/”.
- Set Usage to “Use this node as much as possible”.
- Choose Launch method as “Launch agent via Java Web Start”.
- Set Availability, –> Keep this slave online as much as possible.
- Press Save.
Step 5: Now for connecting to slave to the master by
- Open a browser on the slave machine and go to the Jenkins master server url (http://yourjenkinsmaster:8080).
- Go to Manage Jenkins > Manage Nodes, click on the newly created slave machine.
- Connect agent to Jenkins by one of these ways.
- Launch Agent from Browser.
- Run from agent command line.
- We have chosen second option, login to agent node -> download the slave.jar file from Jenkins Master UI to slave machine then while executing the command, please specify download path of slave.jar file.
nohup java -jar /opt/jenkins/slave.jar -jnlpUrl http://jenkins.local.in:8080/computer/ Jenkins%20Demo%20Slave /slave-agent.jnlp -jnlpCredentials jenkins:jenkins@123 &
start /B java -jar c:\jenkins\slave.jar -jnlpUrl http://jenkins.local.in:8080/computer/jenkinsslave-windows/slave-agent.jnlp -jnlpCredentials jenkins:jenkins@12Now slave node will be in Connected state.
Now node will be in Connected state.