Vagrant安装所遇到的问题
环境:windows10
版本:Vagrant 2.2.6,VirtualBox 6.1.0
No usable default provider could be found for your system.
Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.
The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.
If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
`vagrant up --provider=PROVIDER`, which should give you a more specific
error message for that particular provider.
查询之后发现是 Vagrant 2.2.6 不支持 VirtualBox 6.1.0
修改 Vagrant安装路径
D:\Program Files\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\plugin.rb
添加至61行下面 使用管理员身份
autoload :Version_6_1, File.expand_path("../driver/version_6_1", __FILE__)
再修改
D:\Program Files\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\driver\meta.rb
添加至66行下面 使用管理员身份
"6.1" => Version_6_1,
再新增文件 version_6_1.rb
require File.expand_path("../version_6_0", __FILE__)
module VagrantPlugins
module ProviderVirtualBox
module Driver
# Driver for VirtualBox 6.1.x
class Version_6_1 < Version_6_0
def initialize(uuid)
super
@logger = Log4r::Logger.new("vagrant::provider::virtualbox_6_1")
end
end
end
end
end
完成
vagrant up 启动但是发现还是报错
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'scotch/box'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'scotch/box' is up to date...
==> default: Setting the name of the VM: local-server_default_1457198371829_7646
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "47af6fe7-aa62-4aa6-89d8-e2518f364183", "--type", "headless"]
Stderr: VBoxManage.exe: error: VT-x is disabled in the BIOS for all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
发现我开启了 Hyper-V
控制面板\程序\程序和功能 启用或者关闭windows功能关闭 Hyper-V.
再 vagrant up 还是报错,然后bois启用Intel VT -X. 但是我的bois只有VT -D,也启用
再vagrant up ,可以了