Last active
December 27, 2015 18:29
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# sevien | |
# Setup minimal environment for use virtual machines on VirtualBox 4.3 and Vagrant 1.7.2 (plugins: cachier, hostmanager) | |
codename=$(lsb_release --codename | cut -f2) | |
arch=$(uname -m) | |
# VirtualBox | |
# TODO uninstall VirtualBox | |
if [ $(which vboxmanage) ]; | |
then | |
echo "VirtualBox already installed" | |
vboxmanage list extpacks | |
else | |
# Install VirtualBox | |
echo deb http://download.virtualbox.org/virtualbox/debian $codename contrib | sudo tee /etc/apt/sources.list.d/virtualbox.list | |
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 | |
# tip sudo vboxmanage extpack uninstall "Oracle VM VirtualBox Extension Pack" | |
sudo vboxmanage extpack install /tmp/$file --replace | |
rm /tmp/$file | |
vboxmanage list extpacks | |
fi | |
# Vagrant | |
# TODO uninstall Vagrant | |
if [ $(which vagrant) ]; | |
then | |
echo "$(vagrant --version) already installed and plugins:" | |
vagrant plugin list | |
else | |
# Install requirements for the synced folder of Vagrant | |
sudo apt-get install -y nfs-kernel-server nfs-common portmap | |
# Install Vagrant | |
echo "Install Vagrant..." | |
wget -nv --output-document /tmp/vagrant.deb https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_$arch.deb | |
sudo dpkg -i /tmp/vagrant.deb | |
rm /tmp/vagrant.deb | |
vagrant --version | |
# Optional | |
# mv ~/.vagrant.d/boxes/ ~/space/vagrant/boxes | |
# ln -sf ~/space/vagrant/boxes ~/.vagrant.d/boxes | |
# Install plugin Vagrant Host Manager https://github.com/smdahlen/vagrant-hostmanager | |
vagrant plugin install vagrant-hostmanager | |
# Optional https://github.com/smdahlen/vagrant-hostmanager#passwordless-sudo | |
# echo -e "Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp /home/$USER/.vagrant.d/tmp/hosts.local /etc/hosts \n %sudo ALL=(root) NOPASSWD: VAGRANT_HOSTMANAGER_UPDATE" | sudo tee /etc/sudoers.d/vagrant_hostmanager | |
vagrant plugin install vagrant-cachier | |
# Optional | |
# ln -sf ~/space/vagrant/cache ~/.vagrant.d/cache | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Move to https://github.com/ilyar/setup-work-environment