在 Fedora 21 上默认使用 VirtualBox 提供程序

Flo*_*ine 12 fedora virtualbox vagrant libvirt

现在,每当我使用 vagrant 时,它都会尝试libvirt用作提供程序。我想默认使用 VirtualBox。

vagrant-libvirt 未安装。

这很麻烦,因为有些命令不起作用,例如vagrant status

[florian@localhost local]$ vagrant status
The provider 'libvirt' could not be found, but was requested to
back the machine 'foobar'. Please use a provider that exists.
[florian@localhost local]$ vagrant status --provider=virtualbox
An invalid option was specified. The help for this command
is available below.

Usage: vagrant status [name]
    -h, --help                       Print this help
Run Code Online (Sandbox Code Playgroud)

Flo*_*ine 25

根据vagrant 的文档,默认提供程序应该是virtualbox,并且该VAGRANT_DEFAULT_PROVIDER变量允许您覆盖它。

但是,VAGRANT_DEFAULT_PROVIDER是空的,所以应该是virtualbox,对吧?好吧,如果我将变量设置为virtualbox,它会再次起作用。所以我猜 Fedora 在其他地方设置了默认变量。

解决方案:

$ echo "export VAGRANT_DEFAULT_PROVIDER=virtualbox" >> ~/.bashrc
$ source ~/.bashrc
Run Code Online (Sandbox Code Playgroud)