Skip to content

Instantly share code, notes, and snippets.

@jcppkkk
Last active February 21, 2016 18:01
Show Gist options
  • Save jcppkkk/f09b508b65943bdca00c to your computer and use it in GitHub Desktop.
Save jcppkkk/f09b508b65943bdca00c to your computer and use it in GitHub Desktop.
Setting up a Jenkins slave on Linux
# On slave
adduser --system --group --home=/var/lib/jenkins --no-create-home --disabled-password --quiet --shell /bin/bash jenkins
install -d -o jenkins -g jenkins /var/lib/jenkins
install -d -m 700 -o jenkins -g jenkins /var/lib/jenkins/.ssh
apt-get install -y openjdk-7-jre-headless git-core nfs-common
cat > /etc/cron.hourly/ntpdate <<EOF
#!/bin/bash
ntpdate 172.16.11.254
EOF
chmod +x /etc/cron.hourly/ntpdate
echo "jenkins ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/jenkins
# misc tools
curl -sL bit.ly/prep-ubuntu | bash
apt-get install -y sysstat tig
sudo -H pip install git-up
curl -sSL https://get.docker.com/ | sh
echo 'DOCKER_OPTS="--insecure-registry docker:5000"' >> /etc/default/docker
# start on boot
echo @reboot jenkins java -jar /var/lib/jenkins/slave.jar -jnlpUrl ..... | sudo tee /etc/crontab
# manual start slave now
sudo -H -u jenkins nohup java -jar /var/lib/jenkins/slave.jar -jnlpUrl .....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment