Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I increase the RAM and set up host-only networking in Vagrant?

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.

like image 231
Dc Redwing Avatar asked Sep 06 '12 20:09

Dc Redwing


People also ask

How do I increase RAM size in vagrant?

You can easily increase your VM's RAM by modifying the memory property of config. vm. provider section in your vagrant file. This allocates about 4GB of RAM to your VM.

How do I set up a vagrant network?

Configure port forwarding This allows you to access a port on your own machine, but actually have all the network traffic forwarded to a specific port on the guest machine. To set up a forwarded port so you can access Apache on your guest, add the config. vm.network parameter to your Vagrantfile.

What file does vagrant use to define the memory and number of cpus allocated you your VM?

Increase Memory and CPU on Vagrant machine from commandline When you initialize a new vargant environment, a configuration file named Vagrantfile is created. This file contains the details of operating system and software requirements.

How do I change my default provider on vagrant?

In fact, this is quite common. To make this experience better, Vagrant allows specifying the default provider to use by setting the VAGRANT_DEFAULT_PROVIDER environmental variable. Just set VAGRANT_DEFAULT_PROVIDER to the provider you wish to be the default.


1 Answers

To increase the memory or CPU count when using Vagrant 2, add this to your Vagrantfile

Vagrant.configure("2") do |config|     # usual vagrant config here      config.vm.provider "virtualbox" do |v|         v.memory = 1024         v.cpus = 2     end end 
like image 129
Matt Frear Avatar answered Oct 21 '22 17:10

Matt Frear