Vagrant | Getting started


Installing VirtualBox

Install VirtualBox on Linux
$ sudo apt-get install virtualbox
Install VirtualBox on Mac OS
$ brew cask install virtualbox

Install Vagrant

Install VirtualBox on Linux
$ sudo apt-get install vagrant
$ sudo apt-get install virtualbox-dkms
Install VirtualBox on Mac OS
$ brew cask install vagrant
$ brew cask install vagrant-manager
$ brew cask install vagrant-completion

First Steps

Getting vagrant machine up

 $ vagrant box add precise32
$ vagrant box add hashicorp/precise64

Configure Project

$ mkdir vagrant_project 
$ cd vagrant_project


Configure Vagrant environment

Running X Clients

Allow X-Forwarding

Vagrant.configure(2) do |config|
config.ssh.forward_x11 = true

Check ssh config

$ vagrant ssh-config
Host some_site
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardX11 yes

Run a X client

$ vagrant ssh
vagrant@vagrant: $ sudo apt-get install xclock
vagrant@vagrant: $ exit
$ ssh -X -p 2222 vagrant



Setup Vagrant box

Setup with on command

$ vagrant init hashicorp/precise64

Setup manuell

$ vagrant init

Edit the Vagrantfile in this directory and replace = "precise32"

Start Environment

Start Vagrant box

$ vagrant up

Connect using SSH

$ vagrant ssh

Stop working with Vagrant

$ vagrant halt

Vagrant | Advanced

Build a custum Vagrant Box Install Linux in Virtual Box Run sudo without password Create file /etc/sudoers.d/vagrant vagrant ALL=(ALL) NOPASSWD: ALL Build […]