Configure Jenkins Slaves on Amazon Linux
Prerequisites
- Jenkins Master Running, please refer this link
- EC2 RHEL 7.x Instance – for Slave Node With Internet Access
- Security Group with Port 8080 open for internet
- Java v1.8.x
Install Java
We will be using open java for our demo, Get latest version from http://openjdk.java.net/install/. Also configure the default JAVA_HOME path
yum install java-1.8*
Setup Jenkins Slave
- Create user and add the user to wheel group
useradd jenkins-slave-01
- Create SSH Keys
sudo su - jenkins-slave-01 ssh-keygen -t rsa -N "" -f /home/jenkins-slave-01/.ssh/id_rsa
- The private and public keys will be created at these locations `/home/jenkins-slave-01/.ssh/id_rsa` and `/home/jenkins-slave-01/.ssh/id_rsa.pub`
cd .ssh cat id_rsa.pub > authorized_keys chmod 700 authorized_keys
Configuration on Master
- Copy the slave node’s public key[id_rsa.pub] to Master Node’s known_hosts file
mkdir -p /var/lib/jenkins/.ssh cd /var/lib/jenkins/.ssh ssh-keyscan -H SLAVE-NODE-IP-OR-HOSTNAME >>/var/lib/jenkins/.ssh/known_hosts
- Giving permission
chown jenkins:jenkins known_hosts chmod 700 known_hosts
Configure the Slave using Manage Jenkins
- Configure the node as shown here Manage Jenkins > Manage Nodes > New Node
- Click Save