Vagrant is a software that acts as a wrapper around virtualization software like VirtualBox and VMWare, and provides a more convenient approach to setup reproducible and portable work environments and an efficient and flexible workflow. It can easily be integrated with provisioning tools like Chef and Puppet, and there are many useful plugins that can be installed to add optional features.
vagrant
from your terminal (on windows run it in command prompt, and on OS X run it in Terminal app)cd <path to your directory>
vagrant box add <box name> <path to the .box file>
(e.g. vagrant box add ubuntu13.10 ubuntu-13.10-i386.box
)vagrant init <box name>
. Note: <box name>
should be the same as the one you entered in step 6. (e.g. vagrant init ubuntu13.10
)vagrant up
If the last command works fine, you can connect to your box by running vagrant ssh
.
You may put your projects’ files in the directory that you created during Vagrant setup so you would have access to it from your virual machine instance in /vagrant directory. You have two options to edit and run your codes:
You can install Sublime Text on your host machine and write your codes there and then run them on your virtual machine instance. This way you can interact with your vm instance via ssh.
You can interact with your vm instance via GUI, and write your codes and run them on your vm instance. If you choose this option you have to enable vm GUI in your Vagrant config file by editing Vagrantfile that has been generated in the directory you created while setting up Vagrant and writing/uncommenting the following lines:
config.vm.provider :virtualbox do |vb| vb.gui = true end
Note: make sure you relaunch your vm instance after the changes by running vagrant halt
and then vagrant up
.