美文网首页
1 搭建虚拟机环境

1 搭建虚拟机环境

作者: 天高s | 来源:发表于2021-03-14 13:33 被阅读0次

    Vagrantfile

    boxes = [
        {
            :name => "u1",
            :eth1 => "192.168.0.11",
            :mem => "16384",
            :cpu => "4"
        },
        {
            :name => "u2",
            :eth1 => "192.168.0.12",
            :mem => "16384",
            :cpu => "4"
        },
        {
            :name => "u3",
            :eth1 => "192.168.0.13",
            :mem => "16384",
            :cpu => "4"
        }
    ]
    
    Vagrant.configure(2) do |config|
    
        config.vm.box = "centos/7"
        boxes.each do |opts|
            config.vm.define opts[:name] do |config|
            config.vm.hostname = opts[:name]
            config.vm.provider "virtualbox" do |v|
                v.customize ["modifyvm", :id, "--memory", opts[:mem]]
                v.customize ["modifyvm", :id, "--cpus", opts[:cpu]]
                v.customize ["modifyvm", :id, "--name", opts[:name]]
            end
    
            config.vm.network :public_network, ip: opts[:eth1]
            end
        end
    
    end
    

    假如空间不够用
    vagrant virtualvox 磁盘扩容实践

    相关文章

      网友评论

          本文标题:1 搭建虚拟机环境

          本文链接:https://www.haomeiwen.com/subject/dlzfuhtx.html