系統及軟件版本
- 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
執行成功