Skip to content

Instantly share code, notes, and snippets.

@fourdollars
Last active June 11, 2018 02:17
Show Gist options
  • Save fourdollars/0b891c9ccb1f4af71945 to your computer and use it in GitHub Desktop.
Save fourdollars/0b891c9ccb1f4af71945 to your computer and use it in GitHub Desktop.
Setup the runtime environment for Ubuntu xenial, Java 8, Ruby 1.9.3-p545, Sass 3.4.13 and Compass 1.0.3.
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
echo '==> Preparing prerequisite...'
echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/60language
apt-get autoremove --purge -y -qq virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
apt-get update -qq
apt-get install -y -qq python-software-properties unzip dkms rbenv ruby-build ruby-dev
echo '==> Downloading VBox Guest Additions...'
ver="$(wget -q http://download.virtualbox.org/virtualbox/LATEST.TXT -O -)"
wget -q http://download.virtualbox.org/virtualbox/$ver/VBoxGuestAdditions_$ver.iso -O /root/VBoxGuestAdditions_$ver.iso
mount -o loop,ro /root/VBoxGuestAdditions_$ver.iso /mnt
echo yes | /mnt/VBoxLinuxAdditions.run
umount /mnt
echo '==> Installing Java runtime...'
add-apt-repository -y ppa:webupd8team/java
apt-get update -qq
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
apt-get install -y -qq oracle-java8-installer oracle-java8-set-default
echo '==> Installing sbt...'
echo "deb https://dl.bintray.com/sbt/debian /" > /etc/apt/sources.list.d/sbt.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
apt-get update
apt-get install sbt
echo '==> Installing ruby...'
rbenv install 1.9.3-p545
gem install -q sass -v 3.4.13
gem install -q compass -v 1.0.3
echo '==> Showing the results...'
java -version
sbt help
gem list
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision :shell, inline: $script
config.vm.network :forwarded_port, host: 9000, guest: 9000
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment