Friday, 17 October 2014

Vagrant (Virtual Machine Manager on ubuntu)

Virtual Machine Manager + Vagrant + Generate Multiple VM's + Windows +
 Common Errors + VMware

Steps to starts

. Create a folder anywhere and give entry in the folder
   mkdir tarun

 . cd tarun

 . vagrant init   #it will generate a file named "vagrant" with cinfigurations.

 . cd vagrant

 . Add a box into the ".vagrant.d\boxes\" in C drive.

 . run command  :-
   vagrant box add precise64 "C:\Users\admin\.vagrant.d\boxes\"

 . When you will enter into the vagrant folder you will find a vagrant configuration file. In vagrant configuration file create a global configuration for virtual box. = "precise64"

 . Create the three layers.
   vagrant up

 . Define 3 enviornments with same virtual box.

    config.vm.define "web" do |web| = "web"
      #web.vm.hostname = "web" :private_network, ip: "" :forwarded_port, guest: 80, host: 8080

    config.vm.define "db" do |db| = "db"
      #db.vm.hostname = "mysql" "private_network", ip: "" :forwarded_port, guest: 3306, host: 8888

    config.vm.define "master" do |master| = "master"
      #master.vm.hostname = "master" "private_network", ip: "" :forwarded_port, guest: 80, host: 8080

  . Define networks to communicate. "private_network", ip: ""

  . Define port :forwarded_port, guest: 80, host: 8080

  . After changing run command
    vagrant reload   #helps to configure the changed configuration

  . After generate the three layers, check the virtual box.

  . To enter in the layers, use command
     vergant ssh web 


  Error: Failed to create the host-only adapter :-
  Sol:   Reinstall the virtualbox and run it as administration.
    Or update the virtual box

  Error: Vagrant cannot forward the specified ports on this VM, since they
      would collide with some other application that is already listening
      on these ports. The forwarded port to 8080 is already in use
      on the host machine.
  Sol: write    :-   , auto_correct: true
       else :- Change the host, if already defined.