系统及软件版本
- Win10 专业版
- VirtualBox6.1.0
- Vagrant2.2.6
问题描述
- 新入手的电脑,安装了Vagrant和VirtualBox后准备安装CentOS系统,初始化成功后执行
vagrant up
命令抛出如下提示:
dduan@DESKTOP-FPSM25E MINGW64 /f/Develop/Vagrant/CentOS7_min
$ vagrant up
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 没有对 VirtualBox6.1支持
解决办法
注意:修改配置文件是需要管理员权限
- 修改
D:\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:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\ vagrant2.2.6\plugins\providers\virtualbox\driver\meta.rb
文件,在66行左右增加"6.1" => Version_6_1,
,修改后如下图:
- 在
meta.rb
文件同级目录下新建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
执行成功