-->

Thursday, April 21, 2016

Using Vagrant to run the Ubuntu Machine

Vagrant is particularly helpful in automating the virtual machine setup so that you can create the virtual machine much easily and start using them instead of doing step by step installation of the same. Vagrant using the prebuilt images and would download that automatically as you start off the virtual machine.

1. As a pre-requisite you need to have Oracle Virtual Box which actually runs the virtual machine. You can download the latest virtual box here.

2. You need to download and install the Vagrant. Vagrant can be downloaded here.

Once you have installed the Virtual box and Vagrant, its a matter of few commands to spin up a new Virtual Machine.

Open the windows command line using the cmd in search option.

Create a new folder as C:\vm\test to use it for creating your first virtual machine using Vagrant.

Navigate to that folder in the command line panel


You need to do initiation of the image being used by vagrant. Simply type following command

 vagrant init ubuntu/trusty64 
 vagrant up 



That's it now vagrant would check for the ubuntu trusty64 bit version if its not able to find one would download and spin up a virtual machine for you.


Next you need to connect to the virtual machine and check for the details of the virtual machine. It can be done as follows

 vagrant ssh-config  

This would show you the details of the virtual machine


You would need to create a ppk our of the private_key.pem file it has created and connect via ssh client such as putty. you can generate ppk via puttygen generator.

Once done successfully it would connect to you to virtual machine. By default vagrant user would have the sudo privileges so you can take root also.


You can check the status of the virtual machine from the Oracle Virtual Box also which is right now being controlled by the Vagrant for you.


Are you having any difficulties , kindly comment below.

0 comments:

Post a Comment