Skip to content

Instantly share code, notes, and snippets.

@freshyill
Forked from aweijnitz/Vagrantfile
Last active August 29, 2015 14:24
Show Gist options
  • Save freshyill/508351fcdb51b1efcb34 to your computer and use it in GitHub Desktop.
Save freshyill/508351fcdb51b1efcb34 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ ! -f /usr/bin/git ];
then
echo "-------- PROVISIONING GIT -------------------"
echo "---------------------------------------------"
## Install Git
apt-get update
apt-get -y install git
else
echo "CHECK - Git already installed"
fi
if [ ! -f /usr/bin/build-essential ];
then
echo "-------- PROVISIONING BUILD-ESSENTIAL------------------"
echo "---------------------------------------------"
## Install build-essential
apt-get update
apt-get -y install build-essential
else
echo "CHECK - Build-essential already installed"
fi
## http://crocodillon.com/blog/how-to-install-sassc-and-libsass-on-ubuntu
## Install SassC
cd /usr/local/lib/
git clone https://github.com/sass/sassc.git --branch 3.2.1 --depth 1
## Install LibSass
git clone https://github.com/sass/libsass.git --branch 3.2.1 --depth 1
## Set up LibSass
echo 'SASS_LIBSASS_PATH="/usr/local/lib/libsass"' >> /etc/environment
# Flush the changes…
source /etc/environment
# Make sure it worked…
echo $SASS_LIBSASS_PATH
# Now you can make SassC…
cd /usr/local/lib/sassc/
make
cd /usr/local/lib/sassc/
SASS_LIBSASS_PATH="/usr/local/lib/libsass"; make
cd /usr/local/bin/
ln -s ../lib/sassc/bin/sassc sassc
if [ ! -f /usr/lib/jvm/java-7-oracle/bin/java ];
then
echo "-------- PROVISIONING JAVA ------------"
echo "---------------------------------------"
## Make java install non-interactive
## See http://askubuntu.com/questions/190582/installing-java-automatically-with-silent-option
echo debconf shared/accepted-oracle-license-v1-1 select true | \
debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | \
debconf-set-selections
## Install java 1.7
## See http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get -y install oracle-java7-installer
else
echo "CHECK - Java already installed"
fi
if [ ! -f /etc/init.d/jenkins ];
then
echo "-------- PROVISIONING JENKINS ------------"
echo "------------------------------------------"
## Install Jenkins
#
# URL: http://localhost:6060
# Home: /var/lib/jenkins
# Start/Stop: /etc/init.d/jenkins
# Config: /etc/default/jenkins
# Jenkins log: /var/log/jenkins/jenkins.log
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
apt-get update
apt-get -y install jenkins
# Move Jenkins to port 6060
sed -i 's/8080/6060/g' /etc/default/jenkins
/etc/init.d/jenkins restart
else
echo "CHECK - Jenkins already installed"
fi
echo "-------- PROVISIONING DONE ------------"
echo "-- Jenkins: http://localhost:6060 "
echo "-- Tomcat7: http://localhost:7070 "
echo "---------------------------------------"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
# Named boxes, like this one, don't need a URL, since the are looked up
# in the "vagrant cloud" (https://vagrantcloud.com)
config.vm.box = "chef/debian-7.4"
# Publish guest port 6060 on host port 6060
config.vm.network "forwarded_port", guest: 6060, host: 6060
config.vm.network "forwarded_port", guest: 8080, host: 7070
config.vm.provider "virtualbox" do |vb|
# # Don't boot with headless mode. Use for debugging
# vb.gui = true
# # Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
# Provision the box using a shell script
# This script is copied into the box and then run
config.vm.provision :shell, :privileged => true, :path => "provision.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment