Thursday, March 17, 2016

Vagrant - running a vagrant box in windows 7

Vagrant  - running a box in windows 7



1.  Download and install virtual box from https://www.virtualbox.org/wiki/Downloads
     and start up the virtual box.

2. Download and install vagrant from  http://downloads.vagrantup.com/

I had my vagrant installed in the location C:\HashiCorp\Vagrant.
And added C:\HashiCorp\Vagrant\;C:\HashiCorp\Vagrant\bin to windows environment path.




3.  Also install putty from http://www.putty.org/   for SSH access to the box






4.  I had issues installing the box image using vagrant command, through internet. So I downloaded them and copied them and initiated it locally.

For this I created a project location C:\HashiCorp\Vagrant\Projects\VM

And I downloaded the box file or copied the box file from the url http://files.vagrantup.com/lucid32.box to the default box file location %userprofile%\.vagrant.d\boxes


5.  Add the downloaded box.
For this open the windows command prompt as administrator and add the box to vagrant list using command,

> vagrant box add lucid32 %userprofile%\.vagrant.d\boxes\lucid32.box --provider virtualbox


  note : replace %userprofile% with the location to .vagrant.d folder





6.   Go to the project location C:\HashiCorp\Vagrant\Projects\VM and run the command

> vagrant init lucid32

it will create a vagrant configuration file in the current project location




7. Now start up the VM using the box image lucid32 by running the command

> vagrant up





 8.  To get the ssh details run the command,

> vagrant ssh-config



9. Use the details got from the step 8 to ssh login using putty.

 username : vagrant
 password: vagrant





Now you are in the vm.