Skip to content

Instantly share code, notes, and snippets.

@happysundar
Created January 31, 2014 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save happysundar/8742742 to your computer and use it in GitHub Desktop.
Save happysundar/8742742 to your computer and use it in GitHub Desktop.
useful vagrant commands

Install vagrant-vbguest plugin

This installs the plugin that automatically upgrades the virtual machine’s vbox guest additions to match the virtual box version installed on the host machine:

vagrant plugin install vagrant-vbguest 

Here is how you get a basic Centos 6 box:

vagrant box add centos http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box

After that :

cd ~/VagrantImage (or wherever you want the project to be)

Let vagrant create the Vagrantfile in your project directory:

vagrant init centos (this creates the Vagrantfile in the current dir) 

To actually start and use the VM, do :

  1. vagrant up
  2. vagrant ssh

Note : Within the VM, /vagrant will point to the directory containing the Vagrantfile for this VM ( ~/VagrantImage in our example)

To prevent idle ssh connections from timing out (annoyed me)

Set ssh timeouts to a very high number by logging into the VM, and:

su -
vim /etc/ssh/sshd_config
ClientAliveInterval 6000
ClientAliveCountMax 3
service sshd restart   
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment