How to create a new Jenkins slave

Grégoire Willmann
Nov 6, 2018 · 2 min read

So you have your master instance of Jenkins all set up and now you want to let your slave instances of Jenkins work for you?

Here are a few things to do before being able to use them:

  1. Create a user jenkins with: adduser jenkins
  2. Add your master instance ssh public key to the file /home/jenkins/.ssh/authorized_keys
    It can be as simple as this command: ssh-copy-id -i ~/.ssh/mykey user@host
    Remember that the master should be able to connect to your slave without any password.
  3. Install java with: apt install default-jre

If you plan on using Docker:

Make sure docker runs at startup with: systemctl enable docker and add jenkins user to the docker group: user mod -aG docker jenkins

  • Install docker-compose if you plan on using it also

Add a new node to your master instance of Jenkins

Go to Jenkins →Manage Jenkins →Manage Nodes →New node and fill in the different fields as below. Adapt it to your needs:

Et voila !

Now in your Jenkinsfile use the agent with the label php for example and admire your new slave working for you :)

Grégoire Willmann

Written by

Head of infrastructure at Kinoba | Ruby On Rails expert 👾 | Developing innovative web platforms for our tribe (https://kinoba.fr)

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade