Skip to content

Instantly share code, notes, and snippets.

@awesomejt
Created January 19, 2017 22:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save awesomejt/8c9c6959c35ddf0818930091209d27e7 to your computer and use it in GitHub Desktop.
Save awesomejt/8c9c6959c35ddf0818930091209d27e7 to your computer and use it in GitHub Desktop.
Vagrant file to install Jenkins 2 on Ubuntu 16.04 LTS, along with other tools.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# config.vm.box = "Ubuntu-16LTS"
config.vm.box = "ubuntu/xenial64"
config.vbguest.auto_update = false
config.vm.network "forwarded_port", guest: 8080, host: 8090
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get upgrade -y
echo "Install common tools"
apt-get install -y nano git
echo "Install Java and Maven"
apt-get install -y openjdk-8-jdk openjdk-8-jdk-headless maven
echo "Install Ruby"
apt-get install -y ruby
echo "Install Python 2"
apt-get install -y python python-pip
echo "Install Python 3"
apt-get install -y python3 python3-pip
if [ ! -f /usr/bin/nodejs ]; then
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
apt-get install -y nodejs
sudo apt-get install -y build-essential
npm install -g grunt-cli gulp-cli bower
fi
if [ ! -d /var/lib/jenkins ]; then
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
if [ ! -f /etc/apt/sources.list.d/jenkins.list ]; then
echo "deb https://pkg.jenkins.io/debian-stable binary/" >> /etc/apt/sources.list.d/jenkins.list
fi
apt-get update
apt-get install jenkins -y
if [ -f /var/lib/jenkins/secrets/initialAdminPassword ]; then
cat /var/lib/jenkins/secrets/initialAdminPassword
fi
fi
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment