In this post we will deal with Vagrant Virtual Machine Settings like CPU, RAM, name, GUI and CPU execution cap. These configuration changes are needed as the default box definitions may not be enough for your testing environment.
Here is our example:
Here are the details for each line:
box1.vm.provider “virtualbox” do |vb|
You need to define a new block for each machine to change the settings of it.
vb.customize [“modifyvm”, :id, “–memory”, “2048”]
This line defines RAM as 2 GBs.
vb.customize [“modifyvm”, :id, “–cpus”, “2”]
This line defines two CPUs for the virtual machine.
vb.customize [“modifyvm”, :id, “–cpuexecutioncap”, “50”]
This line ensures that the virtual machine cannot use more than 50% of host CPU.
vb.gui = true
This line enables the GUI of Virtualbox so you can interact with the virtual machine from Virtualbox GUI.
vb.name = “testmyname”
This line gives a meaningful name to your virtual machine in Virtualbox.
Now lets test our config and see what happens with “