在Windows 7 64位上尝试启动虚拟机(Ubuntu 32位)。尽管我在Vagrantfile中添加了modify vm
命令,但在让我的VM显示两个内核时遇到了问题。我的Vagrant版本是1.2.2。
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end
end
使用这个Vagrantfile,我发出了vagrant up
命令。然后,我发出vagrant ssh
,然后是lscpu
,这将产生以下结果:
Architecture: i686
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 58
Stepping: 9
CPU MHz: 2565.513
BogoMIPS: 5131.02
L1d cache: 32K
L1d cache: 32K
L2d cache: 6144K
我认为CPU应该显示2,所以我的虚拟机现在只有一个CPU。如何在运行lscpu
时显示两个CPU
发布于 2015-03-11 07:37:19
如果你使用Oracle Virtualbox运行vagrant,那么最常见的问题是Windows 7、8或10中的Hyper-V。这将限制你使用32位和一个cpu。
运行或搜索"Windows功能“,然后选择”打开或关闭Windows功能“。
在复选框中,确保Hyper-V处于关闭状态-您不能在Microsoft Hyper-V占用Virtualbox的情况下启用VT-x。
然后,您可以使用以下命令使您的Vagrantfile引导非常用户友好:
config.vm.provider "virtualbox" do |vb|
vb.memory = "2404"
vb.cpus = "2"
end
假设您希望有两个运行的内核和略高于2G的内存
别忘了添加你的端口转发。对于PHPStorm (xdebug、mysql和web),我使用:
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
发布于 2015-05-29 00:15:12
您似乎还没有提到您使用的是哪个提供商。从Vagrant1.7开始,许多VM提供程序(如VirtualBox、HyperV)都支持Vagrantfile中的以下配置:
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
查看您在vagrant documentation中使用的特定提供程序。
https://stackoverflow.com/questions/17117063
复制相似问题