Vagrant - Virtualized development for the masses
What is Vagrant?
Development environments made easy.
Create and configure lightweight, reproducible, and portable development environments.
Why Vagrant Changes Everything
Vagrant lowers development environment setup time, maximizes dev/prod parity, and makes the "works on my machine" excuse a relic of the past.
Developers no longer need to worry about setting up complicated infrastructure components. Projects with conflicting dependencies can each get their own sandbox -- keeping a developer's workstation free of the hacks needed for multiple versions of software to coexist.
Operations engineers no longer need to worry about developers having a different local setup from production. They can experiment and test their configuration management changes before going live.
Not convinced? Read more about why Vagrant is right for you.
Install using the operating system specific package
Debian/Ubuntu - deb package
Arch Linux - pkg.tar.xz
RHEL/CentOS/Oracle - rpm package
Windows - msi
Mac OS X - dmg
Install as gem - platform independent, ONLY recommended for 1.0.x
Setup Your First Instance
Vagrant is so easy to use that you can get your first virtual machine up and running in just 3 easy steps:
Installing a Box
Boxes can be installed from the filesystem or via HTTP (note that if you’re interested, it’s quite easy to extend this to support more protocols). No matter the source, the installation method is the same. The following adds a box named precise64 to a local vagrant installation
Since vagrant 1.2.x, user can specify the provider that backs the box by using the --provider option
The name used with the vagrant box add command is the name used to reference the box from that point forward. Any box can be named anything you want. Boxes that are added using vagrant box add are global to the vagrant install, and they are stored at ~/.vagrant.d/boxes on the local filesystem.
Note: The default Vagrantfile created with vagrant init defaults to using a box named "base". It is a good practice to specify a proper name. The name of the box is NOT significant in any way other than to logically identify the box in a Vagrantfile or from the command line.
Boxes can be removed (the deletion is permanent) from ~/.vagrant.d/boxes. The following is an example command to remove a box.
If you tried to run this command, it will obviously fail, since you haven’t added a box named "box_name" yet.
Once a box is removed, no new virtual machines based on that box can be created, since it is completely deleted off the filesystem, but existing virtual machines which have already been spun up will continue to function properly.
Once you have finished testing and don't need the test environment (instance) any more, you can destroy (delete it from VirtualBox Default Machine Folder) with vagrant destroy.
Change Vagrant Home
By default VAGRANT_HOME is ~/.vagrant.d
To change it, in terminal
To make it permanent, add the above to ~/.bash_profile (works for Interactive login shell and Non-interactive login shell).
Most users will use these commands every days:
For more on these commands, please check the built in help:
Local Domain Resolution
Vagrant Base Boxes
A list of places where you can get all sorts of vagrant base boxes for different purposes: development, testing or even production.
- A list of A lit of base boxes for Vagrant
- Opscode bento (Ubuntu, Debian, CentOS, Fedora)
https://github.com/opscode/bento URLs and Veewee definitions
NOTE: For hidden bento boxes, access the root context of AWS S3 storage server directly => https://opscode-vm-bento.s3.amazonaws.com/
- Puppet Labs Vagrant Boxes
Veewee definitions https://github.com/puppetlabs/puppet-vagrant-boxes
- Vagrant Cloud Images - Ubuntu