DEV Community

Grégoire Willmann
Grégoire Willmann

Posted on • Originally published at Medium on

3

How to create a new Jenkins slave

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 :)

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay