image

Jenkins Configuration

1.1.1. Installing Jenkins

Download jenkins.war from http://www.jenkins-ci.org. Now open a terminal and execute java –jar jenkins.war. This will initiate Jenkins in port 8080 by default (if you need to change that port, use — httpPort=9999). Jenkins creates a default workspace for you at ~/.jenkins or it uses the folder specified in JENKINS_HOME environment variable.

Note: – In our project port no is 8080.

On the RedHat Linux you can install from repository by follow following steps:-

To use this repository, run the following commands:-

# sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

 

#yum install Jenkins

Start/Stop

  • service jenkins start/stop/restart

What does this package do?

· Jenkins will be launched as a daemon up on start. See /etc/init.d/jenkins for more details.

· The ‘jenkins’ user is created to run this service. If you change this to a different user via the config file, you must change the owner of /var/log/jenkins, /var/lib/jenkins, and /var/cache/jenkins.

· Log file will be placed in /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.

· /etc/sysconfig/jenkins will capture configuration parameters for the launch.

· By default, Jenkins listen on port 8080. Access this port with your browser to start configuration. 

Go to http://localhost:8080 to check if your installation is working. We will call this page as main screen from now on.

Step by step guide to set up master and slave machines

  1. Manage Jenkins > Manage Nodes.

clip_image002

  1. New Node –> Enter Node Name.
  2. Select Dumb Slave –> Press OK.

clip_image004

  1. Fill out the following:
    1. Set a number of executors (one or more) as needed.
    2. Set a Remote FS Root, a home directory for the master on the slave machine.
      1. For a Windows slave, use something like: “C:\Jenkins\”
      2. TODO: add details.
    3. Select the appropriate Usage setting:
      1. For an additional worker: Utilize this slave as much as possible
      2. For specialized jobs: Leave this machine for tied jobs only
    4. Launch Method:
      1. An easy way to control a Windows slave is by using Launch slave agents via Java Web Start  (Recommended for Windows)
      2. TODO: add steps for other methods.
    5. Availability –> Keep this slave online as much as possible
      1. TODO: add details for each option.
    6. Press OK.

clip_image006

  1. Now you need to connect your slave machine to the master using the following steps.
    1. On you slave machine go to the Jenkins server url.
    2. Go to Manage Jenkins > Manage Nodes, Click on the newly created slave machine.
    3. Click on the Launch button to launch agent from browser on slave.

clip_image008

    1. Run the program.

clip_image010

5. Now you should see the Slave machine connected under Nodes.

  1. If you want the service to run on start-up of the slave machine do the following (Windows only directions):
    1. In the Slave agent program running on your slave machine, click File –> Install as Windows Service.

clip_image012

    1. Start, type Services and Select the Services program.
    2. Find Jenkins Slave in the list, Double click to open.
    3. Select Startup type –> Automatic.
    4. Go to the Log On tab, change the Log on as to a user of your choice (Special user account Jenkins recommended).
    5. Make sure that auto login is set for the slave machine for the user account, then the VM (or physical computer) should connect and be available when needed.

Leave a Reply