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:
- Create a user jenkins with: adduser jenkins
- 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.
- Install java with: apt install default-jre
If you plan on using Docker:
- Install Docker (https://docs.docker.com/install/)
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 :)