Thursday 1 September 2016

Vagrant

VAGRANT


vagrant init hashicorp/precise64
vagrant up
vagrant box add hashicorp/precise64

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64" ---simple 1 machine in vagrant
end

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64" ---one machine with specified version
  config.vm.box_version = "1.1.0"
end


Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.box_url = "http://files.vagrantup.com/precise64.box" ---- direct url for machine
end

vagrant ssh ---ssh to vagrant machine 
vagrant destroy -- to destroy bvagrant machine

vagrant box remove ---to remove the bo completely

/vagrant --- shared folder in vagrant 

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.provision :shell, path: "bootstrap.sh"  -----This is to run a shell script from vagrantfile
end

vagrant reload --provision ---restart u r virtual machine



Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.provision :shell, path: "bootstrap.sh"
  config.vm.network :forwarded_port, guest: 80, host: 4567 ------ Port forwarding on vagrant
end


vagrant share ---vagrant share in vagrant 
vagrant destroy --- to destroy vagrant

No comments:

Post a Comment