Initial Setup (from scratch)
Now that we have what we need installed, a nice and healthy explanation of
Vagrant and the hype behind it, let's dive in and start actually seeing this in action.
A super-cool shortcut to getting started is the command
vagrant init. This command is great because it will create an official vagrant boilerplate for you automatically. This way you don't have to write all the
Vagrantfile stuff out by hand for setup.
vagrant init hashicorp/precise64
This will produce a
ruby file called
Vagrantfile with a ton of code and comments inside of it. You can try to read through the comments or keep watching the videos to see it broken down.
After you gut through all those comments, there's a few important things to notice.
Comment Blocks at the Top
Just ignore this. It tells command-line editors that this is a
Ruby file. You don't have to know
Ruby to understand what's going on in here.
# -*- mode: ruby -*- # vi: set ft=ruby :
The Start and End
Ruby, the Vagrant file begins and ends with this. Similar to a
Vagrant.configure("2") do |config| # Example # # config.vm.thing_i_want_to_do1 # config.vm.thing_i_want_to_do2 # config.vm.thing_i_want_to_do3 # # Etc... end