gpt4 book ai didi

networking - 如何在 Vagrant 中增加 RAM 并设置仅主机网络?

转载 作者:行者123 更新时间:2023-12-03 05:01:10 25 4
gpt4 key购买 nike

我想将 RAM 增加到至少 1 GB,并且我想配置“仅主机”网络以使用“199.188.44.20”。

这是我的Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|

config.vm.customize ["modifyvm", :id, "--memory", 1024]

config.vm.network :hostonly, "199.188.44.20"

config.vm.define :web do |web_config|
web_config.vm.box = "lucid32"
web_config.vm.forward_port 80, 8080

web_config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "lucid32.pp"
end
end

config.vm.define :web2 do |web2_config|
web2_config.vm.box = "lucid32"
web2_config.vm.forward_port 80, 8081

web2_config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "myweb.pp"
end
end
end

但是,当我运行 vagrant up 时,我得到:

The VM failed to remain in the "running" state while attempting to boot. This is normally cause by a misconfiguration or host system incompatibles. Please open the VirtualBox GUI and attempt to boot the virtual machine manually to get more informative error message

并且,当我尝试登录虚拟机时收到连接拒绝错误。

最佳答案

要在使用 Vagrant 2 时增加内存或 CPU 数量,请将其添加到您的 Vagrantfile

Vagrant.configure("2") do |config|
# usual vagrant config here

config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
end

关于networking - 如何在 Vagrant 中增加 RAM 并设置仅主机网络?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12308149/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com