Skip to content

Instantly share code, notes, and snippets.

@ilyar
Last active December 27, 2015 18:29
Show Gist options
  • Save ilyar/10951306 to your computer and use it in GitHub Desktop.
Save ilyar/10951306 to your computer and use it in GitHub Desktop.
Setup minimal environment for use virtual machines on VirtualBox 4.3 and Vagrant 1.7.2 (plugins: cachier, hostmanager)
#!/bin/bash
# envall
# Install Ruby 2.1.1, VirtualBox 4.3 and Vagrant 1.5.3 (plugins: berkshelf, omnibus)
codename=$(lsb_release --codename | cut -f2)
#arch=$(dpkg --print-architecture)
arch=$(uname -m)
# Ruby
if [ $(which ruby) ];
then
echo "Ruby $(ruby --version) already installed"
else
echo "Install Ruby..."
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.1
rvm use 2.1.1 --default
ruby -v
git --version
fi
# VirtualBox
if [ ! -x $(which vboxmanage) ];
then
# Install VirtualBox
echo deb http://download.virtualbox.org/virtualbox/debian $codename contrib | sudo tee -a /etc/apt/sources.list #TODO add check availability of source
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y virtualbox-4.3
# Install VirtualBox Extension Pack
version=$(vboxmanage -v)
var1=$(echo $version | cut -d 'r' -f 1)
var2=$(echo $version | cut -d 'r' -f 2)
file="Oracle_VM_VirtualBox_Extension_Pack-$var1-$var2.vbox-extpack"
wget http://download.virtualbox.org/virtualbox/$var1/$file -O /tmp/$file
#sudo vboxmanage extpack uninstall "Oracle VM VirtualBox Extension Pack"
sudo vboxmanage extpack install /tmp/$file --replace
rm /tmp/$file
vboxmanage list extpacks
else
echo "VirtualBox already installed"
vboxmanage list extpacks
fi
# Vagrant
if [ $(which vagrant) ];
then
echo "$(vagrant --version) already installed"
else
echo "Install Vagrant..."
wget -nv --output-document /tmp/vagrant.deb https://dl.bintray.com/mitchellh/vagrant/vagrant_1.5.3_$arch.deb
sudo dpkg -i /tmp/vagrant.deb
rm /tmp/vagrant.deb
vagrant --version
echo "Install Vagrant plugin berkshelf..."
vagrant plugin install vagrant-berkshelf --plugin-version 2.0.0.rc3
echo "Install Vagrant plugin omnibus..."
vagrant plugin install vagrant-omnibus
fi
@ilyar
Copy link
Author

ilyar commented Nov 20, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment