Vagrantfile:如何增加ram和设置仅主机网络? [英] Vagrantfile: how do I increase ram and set up host-only networking?
问题描述
我想将RAM增加到至少1 GB,并且我想将仅限主机的网络配置为使用199.188.44.20。
这是我的 Vagrantfile
:
# - * - * -
然而,当我运行
#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 时,我得到
通过添加以下配置来修改各种VM属性(有关更多信息,请参阅Vagrant文档) :VM失败在尝试引导时保持在运行状态。这通常是由于配置不正确或主机系统不兼容。请打开VirtualBox GUI并尝试手动引导虚拟机以获取更多信息性错误消息
然后,我得到一个<$ c
解决方案当您尝试登录虚拟机时,可能会出现$ c>连接拒绝
#配置VM Ram使用
config.vm.customize [
modifyvm,:id ,
--name,Test_Environment,
--memory,1024
]
您可以从VirtualBox命令行选项的文档中获取要更改的属性:
vagrant文档有如何更改IP地址的部分:
Vagrant :: Config.run do | config |
config.vm.network:hostonly,192.168.50.4
end
也可以重组这样的配置,结束是做结尾而不嵌套它。
这更简单。
config.vm.define:web do | web_config |
web_config.vm.box =lucid32
web_config.vm.forward_port 80,8080
end
web_config.vm.provision:puppet do | puppet |
puppet.manifests_path =manifests
puppet.manifest_file =lucid32.pp
end
I would like to increase the RAM to at least 1 GB and I would like to configure "Host-Only" networking to use "199.188.44.20".
This is my 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
However, when I run vagrant up
I am getting 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
And, I am getting a connection refuse
error when I try to log in to the VM.
You can modify various VM properties by adding the following configuration (see the Vagrant docs for a bit more info):
# Configure VM Ram usage
config.vm.customize [
"modifyvm", :id,
"--name", "Test_Environment",
"--memory", "1024"
]
You can obtain the properties that you want to change from the documents for VirtualBox command-line options:
The vagrant documentation has the section on how to change IP address:
Vagrant::Config.run do |config|
config.vm.network :hostonly, "192.168.50.4"
end
Also you can restructure the configuration like this, ending is do with end without nesting it. This is simpler.
config.vm.define :web do |web_config|
web_config.vm.box = "lucid32"
web_config.vm.forward_port 80, 8080
end
web_config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "lucid32.pp"
end
这篇关于Vagrantfile:如何增加ram和设置仅主机网络?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!