How can I create a VM in Vagrant with VirtualBox with two CPUs?
Add vb.customize ["modifyvm", :id, "--ioapic", "on"]
to the config.vm.provider
block inside your Vagrantfile.
Looking at the VirtualBox documentation it mentions:
"Note Enabling the I/O APIC is required for 64-bit guest operating systems, especially Windows Vista; it is also required if you want to use more than one virtual CPU in a virtual machine."
If you are running vagrant using Oracle Virtualbox then the most common issue is with Hyper-V in Windows 7, 8 or 10. That will limit you to 32bit and one cpu.
Run or search for "Windows Features" and select "Turn Windows Features On or Off".
In the checkboxes make sure Hyper-V is off - you can't enable VT-x for Virtualbox with Microsoft Hyper-V hogging it.
Then, you can make your Vagrantfile boot very user friendly with:
config.vm.provider "virtualbox" do |vb|
vb.memory = "2404"
vb.cpus = "2"
end
Assuming you want to have two cores running and just a bit over 2 Gig of memory
ps - don't forget to add your port forwarding. For PHPStorm (xdebug, mysql, and web) I use:
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 3306, host: 3306
config.vm.network "forwarded_port", guest: 9000, host: 9000
It seems you have not mentioned which provider you are using. As of Vagrant 1.7 many VM providers (such as VirtualBox, HyperV) supports the following configuration in your Vagrantfile:
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
Check out the specific provider you are using in the vagrant documentation.