多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
两个月前自己搭好了打包了一个lnmp的box,现在用`vagrant up`命令无法启动起来,报如下提示: ``` The provider 'virtualbox' that was requested to back the machine 'default' is reporting that it isn't usable on this system. The reason is shown below: Vagrant has detected that you have a version of VirtualBox installed that is not supported by this version of Vagrant. Please install one of the supported versions listed below to use Vagrant: 4.0, 4.1, 4.2, 4.3, 5.0, 5.1, 5.2, 6.0 A Vagrant update may also be available that adds support for the version you specified. Please check www.vagrantup.com/downloads.html to download the latest version. ``` 在网上找到了方案,作者情况与我一样,最后按步骤成功解决。这里照搬下,并附上原作者攻略链接: https://hacpai.com/article/1576163288162 以下内容为照搬,步骤很清晰了,就不做改动。 通过该链接点到 Vagrant 在 GitHub 上的仓库,灵机一动去查看了 issue,果然有人和我遇到了同样的问题,并且神通广大的网友给出了解决方案。 [https://github.com/oracle/vagrant-boxes/issues/178](https://hacpai.com/forward?goto=https%3A%2F%2Fgithub.com%2Foracle%2Fvagrant-boxes%2Fissues%2F178) 我参考上面的步骤进行了如下操作: 1.进入我的 Vagrant 安装目录`D:\HashiCorp\Vagrant`(ps:默认安装在 c 盘的这个目录下,我安装时只修改了盘符) 2.修改`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__)` ![image.png](https://img.hacpai.com/file/2019/12/image-d9e4175f.png?imageView2/2/interlace/1/format/webp) 679 x 254 记住使用管理权限修改。 3.修改`D:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\ vagrant2.2.6\plugins\providers\virtualbox\driver\meta.rb`文件,在 66 行左右增加`"6.1" => Version_6_1,`,修改后如下图: ![image.png](https://img.hacpai.com/file/2019/12/image-b2c18a2a.png?imageView2/2/interlace/1/format/webp) 472 x 212 同时在当前目录下新建`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 ~~~ 到这里就结束了,然后尝试启动 CentOS7,启动成功: ![image.png](https://img.hacpai.com/file/2019/12/image-75dba06d.png?imageView2/2/interlace/1/format/webp) 738 x 463 1044 x 655 总结:在我们使用一些开源工具的时候,如果遇到自己搞不定的问题时,可以去 GitHub 上看看 issue,也许有意外惊喜。 作者:arrayMi 链接:https://hacpai.com/article/1576163288162 来源:黑客派 协议:CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0/ 开源软件的问题,直接去开源处。通常是github的issue去找方案,因为很可能别人已经遭遇过了。