Using Vagrant

From LSDevLinux
Jump to: navigation, search

Vagrant is software to "create and configure lightweight, reproducible and portable development environments".


Installation

Download and install Vagrant within minutes of OS X, Windows, or popular distributions of Linux. Vagrant can use different virtual machine technologies. This guide will use virtual box.

Ubuntu

Install Vagrant:

sudo apt-get install vagrant

Install Virtual Box:

sudo apt-get install virtualbox-5.1

Windows

Install Virtual Box:

cinst virtualbox

Make sure VBoxManage is correctly in the path.

Install Vagrant:

cinst vagrant

OS X

Install Vagrant:

Install Virtual Box:

Plugins

Vagrant has a plugin architecture with a number of Available Plugins.

It is recommended to use the following plugins:

  • vagrant-cachier - caches packages for different managers like apt, yum
  • vagrant-vbguest - automatically update Virtual Box guest additions if necessary

To install a plugin, execute vagrant at the command-line:

vagrant plugin install <plugin_name>

Note: Currently there is a bug in vagrant-cachier (https://github.com/fgrehm/vagrant-cachier/issues/106) where the apt_lists caches are not updated correctly. On Windows, do not install vagrant-cachier.

Pre-configured Boxes

Clone the vagrant-sil repo to use pre-configured boxes:

git clone https://github.com/chrisvire/vagrant-sil
cd vagrant-sil

See a list of available boxes:

vagrant status

Download and start a box:

vagrant up <box_name>

Note: The box is cached in $HOME/.vagrant.d

Notes on configuration

Note: Default Settings

  • Use vagrant user and password during install
  • VirtualBox
    • Install VBGuestAdditions
    • Eject the VBGestAdditions ISO
    • Devices: Shared Clipboard: Bidirectional
  • insecure keypair
mkdir ~/.ssh
chmod 0700 ~/.ssh
wget -O - https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub > ~/.ssh/authorized_keys
chmod 0600 ~/.ssh/authorized_keys
  • password-less sudo
sudo visudo
(add "vagrant ALL=(ALL) NOPASSWD: ALL")
  • ssh tweaks
cd /etc/ssh
sudo vi sshd_config
(uncomment or add "UseDNS no")
  • sudo apt-get install -y curl aptitude synaptic git vim wget meld git-gui gitk kdiff3-qt terminator ssh gdebi
  • Add PSO package repos
    • Note: for Wasta, use ubuntu base distro (e.g. "precise") instead of $(lsb_release -sc) since this will return maya
wget -qO - http://packages.sil.org/sil.gpg | sudo apt-key add -
sudo add-apt-repository "deb http://packages.sil.org/ubuntu $(lsb_release -sc) main"
sudo add-apt-repository "deb http://packages.sil.org/ubuntu $(lsb_release -sc)-experimental main"
sudo apt-get update
  • change .bashrc to use:
if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w$(__git_ps1)\[\033[00m\]\n\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1)\n\$ '
fi
  • set environment
    • echo export FEEDBACK=off >> ~/.profile
    • echo export WESAY_TRACK_AS_DEVELOPER=1 >> ~/.profile
  • sudo apt-get install ttf-mscorefonts-installer
  • sudo apt-get remove deja-dup
    • Note: Don't need to do backup of vagrant machines
  • Brightness and Lock Settings
    • Turn screen off when inactivate: Never
    • Lock: Off
  • Appearance
    • In Behavior, Change "Show the menus for a window" to "In the window's title bar"
  • Dash
    • Remove LibreOffice
    • Add Terminal
  • Terminal
    • Change the Profile Colors to "Green on black"
  • Change the background