Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Jenkins on server
#!/bin/bash
#
# A simple script to install jenkins on debian/ubuntu
# Tested on a new Debian 8 DreamCompute image from Dreamhost.
#
AUTHBIND_PORT=/etc/authbind/byport/80
sudo apt-get update
sudo apt-get install --force-yes -y apt-transport-https wget openjdk-8-jdk git subversion ca-certificates-java vim authbind binfmt-support
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
echo "deb https://pkg.jenkins.io/debian-stable binary/" > /etc/apt/sources.list.d/jenkins.list
sudo apt-get update
sudo apt-get install -y jenkins
# The following will set jenkins up to work on port 80. Simple and stupid
sed -i 's/JAVA=\/usr\/bin\/java/JAVA=\"authbind \/usr\/bin\/java\"/g' /etc/default/jenkins
sed -i 's/HTTP_PORT=8080/HTTP_PORT=80/g' /etc/default/jenkins
touch $AUTHBIND_PORT
chmod 500 $AUTHBIND_PORT
chown jenkins $AUTHBIND_PORT
# Setup a few needed things in the environment for the debian pbuilder to work
cat > /etc/sudoers.d/jenkins << EOF
jenkins ALL=NOPASSWD: /usr/sbin/cowbuilder, /usr/sbin/chroot
Defaults env_keep+="DEB_* DIST ARCH"
EOF
# note: must install cowbuilder manually, pbuilder prompts for input
sudo apt-get install -y qemu-user-static devscripts
sudo systemctl restart jenkins
# After install, run this:
# sudo apt-get install cowbuilder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment