DEV Community

loading...

How to create a new Jenkins slave

Grégoire Willmann
Co-founder and developer at Kinoba (https://kinoba.fr)
Originally published at Medium on ・1 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 :)

Discussion (0)