Last Updated: September 27, 2021
·
11.83K
· akalyaev

Vagrant tips

This is the list of Vagrant configuration options and plugins which I found very useful. Also downstairs are the lists of tools, services and other interesting things :)

Config options

Provide default box url

config.vm.box_url = "http://dl.dropbox.com/u/937870/VMs/squeeze64.box"

This is used if the box doesn't already exist. When vagrant up is called and the box is not found, this option is used to download the box.

Use NFS for syncing folders

config.vm.synced_folder "~/Dropbox", "/Dropbox", :nfs => true

It's much faster. Read https://coderwall.com/p/uaohzg for more info.

Note Some people have reported problems with permissions. This may be due to duplicated records in /etc/exports (when you are using the same IP address across all of your boxes). So, please, give each of your boxes an unique IP address.

Forward your SSH keys into Vagrant box

config.ssh.forward_agent = true

I use this to deploy my apps from inside the box. Very useful!

Plugins

vagrant-vbguest

vagrant plugin install vagrant-vbguest

This plugin will automatically install (or just check that versions are the same) the host's VirtualBox Guest Additions on the guest system.

vagrant-berkshelf

vagrant plugin install vagrant-berkshelf

Berkshelf integration. Vagrant will automatically run it before any provisioning step.

vagrant-librarian-chef

vagrant plugin install vagrant-librarian-chef

Librarian-Chef integration. Vagrant will automatically run it before any provisioning step.

vagrant-omnibus

vagrant plugin install vagrant-omnibus

Installs latest Chef-solo. (Thanks to @tralamazza)

vagrant-cachier

vagrant plugin install vagrant-cachier

A Vagrant plugin that helps you reduce the amount of coffee you drink while waiting for boxes to be provisioned by sharing a common package cache among similiar VM instances. (Thanks to @juliendubreuil)

Providers

Tools

veewee

A tool for easily (and repeatedly) building custom Vagrant base boxes, KVMs, and virtual machine images. (Thanks to @av-ast)

Services

Rove.io

Rove.io is a service that allows you to pregenerate typical Vagrant builds (Chef).

PuPHPet

A simple GUI to set up virtual machines for PHP Web development (Puppet).

Boxes lists


Feel free to leave a comment if you have something to add.

10 Responses
Add your response

A list of of ready-to-use Vagrant boxes http://www.vagrantbox.es/

over 1 year ago ·

https://github.com/jedi4ever/veewee
A tool for easily (and repeatedly) building custom Vagrant base boxes, KVMs, and virtual machine images.

over 1 year ago ·

If you have a box on a remote server and it gets stuck at boot time, you can run it with the RDP-server.

First, you need install Oracle Extension Pack

# VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.16-86992.vbox-extpack

Next step, is to get VirtualBox name for vagrant box:

# VBoxManage list vms
"vagrant_1373795168" {e76864cc-ee28-46f3-86a6-7b684b299f3a}

Finally, start your box directly from VirtualBox

# VBoxHeadless --startvm "vagrant_1373795168" -v on --vrdeproperty "TCP/Address"=192.168.0.231 --vrdeproperty "TCP/Ports"=3389 --vrdeproperty "VNCPassword"=somepass

Now you can connect to the box using RDP client (http://cord.sourceforge.net/ for MacOS for example).

over 1 year ago ·

@av-ast Thanks! I've updated the protip.

over 1 year ago ·

@numbata You could extract it to a separate protip, I think) But thanks for mentioned it here.

over 1 year ago ·

Installs latest chef-solo

vagrant plugin install vagrant-omnibus

EC2 Provider

vagrant plugin install vagrant-aws
over 1 year ago ·

@akalyaev you should checkout https://github.com/locomote/gusteau for some awesome vagrant / chef solo integration.

over 1 year ago ·

Another interesting plugin is vagrant-cachier https://github.com/fgrehm/vagrant-cachier. It will help you reduce the waiting time for boxes to be provisioned by downloading sources from repositories.

over 1 year ago ·
over 1 year ago ·

Easily execute commands in VM - https://github.com/p0deje/vagrant-exec

over 1 year ago ·