Virtualbox7.0 + Vagrant-2.3.1安装测试

Virtualbox7.0 + Vagrant-2.3.1安装测试

Virtualbox7.0官网
Virtualbox7.0下载安装文件,再下载Virtualbox扩展文件

Vagrant官网
Vagrant下载安装文件,Windows系统选择amd64

参考 Windows10安装VirtualBox & Vagrant
安装好Virtualbox7.0、Virtualbox扩展,Vagrant

由于Vagrant-2.3.1还不支持Virtualbox7.0,需要修改Vagrant的配置文件

参考 国外大神配置Vagrant2.3

假定Vagrant安装在目录:D:\software\Vagrant

  1. 修改meta.rb文件路径 D:\software\Vagrant\embedded\gems\2.3.1\gems\vagrant-2.3.1\plugins\providers\virtualbox\driver
#增加1行
			"7.0" => Version_7_0,
  1. 在meta.rb同目录创建文件:version_7_0.rb
require File.expand_path("../version_6_0", __FILE__)

module VagrantPlugins
  module ProviderVirtualBox
    module Driver
      # Driver for VirtualBox 7.0.x
      class Version_7_0 < Version_6_1
        def initialize(uuid)
          super

          @logger = Log4r::Logger.new("vagrant::provider::virtualbox_7_0")
        end

        def read_dhcp_servers
          execute("list", "dhcpservers", retryable: true).split("\n\n").collect do |block|
            info = {}

            block.split("\n").each do |line|
              if network = line[/^NetworkName:\s+HostInterfaceNetworking-(.+?)$/, 1]
                info[:network]      = network
                info[:network_name] = "HostInterfaceNetworking-#{network}"
              elsif ip = line[/^Dhcpd IP:\s+(.+?)$/, 1]
                info[:ip] = ip
              elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1]
                info[:netmask] = netmask
              elsif lower = line[/^LowerIPAddress:\s+(.+?)$/, 1]
                info[:lower] = lower
              elsif upper = line[/^UpperIPAddress:\s+(.+?)$/, 1]
                info[:upper] = upper
              end
            end

            info
          end
        end
      end
    end
  end
end
  1. 修改文件plugin.rb,路径:D:\software\Vagrant\embedded\gems\2.3.1\gems\vagrant-2.3.1\plugins\providers\virtualbox
#查找module Driver,添加1行
	  autoload :Version_7_0, File.expand_path("../driver/version_7_0", __FILE__)

使用Vagrantfile启动CentOS7

创建文件 Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "centos7"
  config.vm.box_url = "https://mirrors.ustc.edu.cn/centos-cloud/centos/7/vagrant/x86_64/images/CentOS-7.box"
  config.vm.network "public_network"
end

使用管理员权限打开一个cmd窗口,执行命令

vagrant up

你可能感兴趣的:(vagrant,vagrant,oracle,数据库)