How can I create a VM in Vagrant with VirtualBox with two CPUs?

后端 未结 3 1550
耶瑟儿~
耶瑟儿~ 2021-01-31 01:31

On Windows 7 64 bit trying to start up a VM (Ubuntu 32 bit). I\'m having trouble getting my VM to show two cores despite adding the modify vm command in my Vagrantf

相关标签:
3条回答
  • 2021-01-31 01:49

    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."

    0 讨论(0)
  • 2021-01-31 01:49

    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.

    0 讨论(0)
  • 2021-01-31 01:50

    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
    
    0 讨论(0)
提交回复
热议问题