Skip to content

Instantly share code, notes, and snippets.

@devopsmariocom
Last active August 29, 2015 14:17
Show Gist options
  • Save devopsmariocom/702bc4ed38e3f8ec6d84 to your computer and use it in GitHub Desktop.
Save devopsmariocom/702bc4ed38e3f8ec6d84 to your computer and use it in GitHub Desktop.
Vagrant 101

Vagrant 101

What is Vagrant

Tool for creating and managing virtual machines for development purpose.

You can setup specific os with specific provision scripts to build consistent dev environment.

First you need to create Vagrant file where you specify VM options and how you want to provision(Chef/Puppet/BASH/Ansible/Salt/Docker)

On vagrant up vagrant will:

  1. Fetch/start specified VM
  2. Mount project directory to VM /vagrant folder
  3. Setup port forwarding specified in Vagrantfile
  4. Provision VM using way you have specified in Vagrantfile

Prerequisites

  1. Checkout your project repository
  2. Install VirtualBox
  3. Install Vagrant

Start Vagrant

  1. Go to your repository directory from command line
  2. run vagrant up
  3. wait... this take some time to download all files

Use Vagrant

  • Start machine vagrant up
  • Save gracefully machine state vagrant suspend
  • Resume machine after suspend vagrant resume
  • Log in to the machine vagrant ssh repository files are mounted to /vagrant folder
  • Destroy machine with vagrant destroy
  • Gracefully shut down the guest operating system and power down the guest machine with vagrant halt
@Hotell
Copy link

Hotell commented Mar 29, 2015

consider adding to Use Vagrant chapter:

  • will gracefully shut down the guest operating system and power down the guest machine with vagrant halt

thx

hejhola

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