Vagrant is an open source tool for building a complete virtual development environment. A test environment is required for testing the latest release and new tools. It works on Linux, Mac OS X, or Windows and although by default it uses VirtualBox for managing the virtualization, it can be used with other providers such as VMware or AWS.
How to install Vagrant
First you need to download and run the installation kit.
Check that you have dpkg and Virtual box installed:
$ sudo apt-get install virtualbox
$ sudo apt-get install vagrant
Install the dkms package to ensure that the VirtualBox host kernel modules (vboxdrv, vboxnetflt and vboxnetadp) are properly updated if the Linux kernel version changes during the next apt-get upgrade.
$ sudo apt-get install virtualbox-dkms
Vagrant can quickly deploy the development environment. Get the vagrant images from here.
The following command will install precise32 box from the vagrant website.
$ vagrant box add precise32 http://files.vagrantup.com/precise32.box
-Then create a vagrant file in this folder by calling 'vagrant init', which will be the central file for the project configuration.
$ mkdir vagrant_project $ cd vagrant_project $ vagrant init
Edit the Vagrantfile in this directory and replace
config.vm.box = "precise32"
This will tell it to use this new box. Save the file and exit. Now you can deploy the guest machine with the following command:
This will bring up a VPS running Ubuntu 12.04 LTS. To make use of it, you can easily SSH into it:
After you are done working with the guest machine, you can exit and go back to the host with the following command:
If you want to stop and remove the guest machine and all traces of it, run the following command from the host machine:
The files that were synchronized with the host machine will not be removed from the host. Additionally, you can redeploy the guest machine again for this configuration using the same vagrant up command.