Thursday, 31 August 2017

Vagrant

1. Need to download virtual machine from  https://www.virtualbox.org/wiki/Downloads
2. Download VM Package according to version https://www.virtualbox.org/wiki/Downloads
3. Download vagrant from  https://www.vagrantup.com/downloads.html

Firstly, install VM
Then install vagrant, which will be help to setup the vagrant environment for setup the VM
After installing vagrant , Run below mentioned command:-

> vagrant init
  - This command will generate the default vagrant file and directory structure
  - Edit the vagrant file and update below mentioned code in vagrant file

    VAGRANTFILE_API_VERSION = "2"


Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :chefMaster do |master|
  master.vm.hostname = "<here enter host i.e. abc.com>"
  master.vm.box      = "<here enter box name i.e. base>"
             master.vm.boot_timeout = <time out in number>
  master.vm.box_url  = "<here enter box image url>"
 master.vm.network :private_network, ip: "<here type ip address>"    
 master.vm.network :forwarded_port, guest: 443, host: 8443

 config.vm.provider :virtualbox do |master|
master.customize ["modifyvm", :id, "--memory", "1024"]
 end

end

end


> vagrant up
   - This command will download the vm at local and access it with mentioned ip in vagrant file.
   - Default credential is root/vagrant