- >mkdir nombre_carpeta
- >vagrant init
- >vi Vagrantfile
- En aquest punt editarem el fitxer modificant errors com, modificar diverses línies de majúscules a minuscules perquè el vagrantfile no ho saber llegir.
- Tambe es possible que alguna linea amb “end” estigui mal posicionada.
- # -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The “2” in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don’t change it unless you know what
# you’re doing.
Vagrant.configure(“2”) do |config|
config.vm.define “nombre_maquina” do |mv|
mv.vm.box = “nombre_caja”
mv.vm.network “public_network”,
ip: “0.0.0.0”,
netmask: “0.0.0.0”,
gateway: “0.0.0.0”,
bridge: “eth0”
mv.vm.network “private_network”,
ip: “0.0.0.0”,
netmask: “0.0.0.0”,
gateway: “0.0.0.0”, (no es necesaria)
virtualbox__intnet: “red_privada”
end
end
~
- Un cop fet això iniciarem executant vagrant up.
- Dins aquest fitxer també es poden modificar diversos valors més.
Un exemple
Configuración del cliente Windows
config.vm.define “windows_client” do |windows|
windows.vm.box = “gusztavvargadr/windows-10”
windows.vm.network “private_network”,
ip: “10.0.5.3”,
netmask: “255.255.255.192”,
virtualbox__intnet: “red_privada”
windows.vm.provider “virtualbox” do |vb|
vb.memory = “4096”
vb.cpus = 2
windows.vm.provision “shell”, inline: <<-SHELL
ip route del default
SHELL
end
end
end