Skip to content

Instantly share code, notes, and snippets.

@datalove
Last active August 29, 2015 14:21
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 datalove/2f7c87bbf43cfda437a5 to your computer and use it in GitHub Desktop.
Save datalove/2f7c87bbf43cfda437a5 to your computer and use it in GitHub Desktop.

Vagrant

  • Download and install vagrant from vagrantup.com (requires system restart)
  • Other stuff

Download a box image : http://hashicorp-files.vagrantup.com/precise32.box

vagrant init
vagrant box add --name mybox precise32.box

Now before actually starting the box, let's do some further configuration.

Vagrant + Corp Proxy

The stuff below is inspired by this stackoverflow question.

First connect to wifi-hotspot to allow installation of the plugin below.

vagrant plugin install vagrant-proxyconf

Add the following to the Vagrantfile to work with vagrant-proxyconf plugin

Vagrant.configure("2") do |config|
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://username:password@192.168.0.2:3128/"
    config.proxy.https    = "http://username:password@192.168.0.2:3128/"
    config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
  end
  # ... other stuff
end

While we're in the vagrantfile, we'll need to set up port-forwarding for RStudio Server (which uses 8787 by default). So where the # ... other stuff is, insert the following:

config.vm.network "forwarded_port", guest:8787, host:8787

Start the VM

This starts the VM and connects to it using SSH

vagrant up
vagrant ssh

RStudio

To install RStudio

Run the following inside the VM

sudo apt-get update
sudo apt-get install curl
sudo apt-get install gdebi-core
sudo apt-get install libapparmor1 # Required only for Ubuntu, not Debian
wget http://download2.rstudio.org/rstudio-server-0.98.1103-i386.deb
sudo gdebi rstudio-server-0.98.1103-i386.deb

Note that the service is automatically started after installation, but if you need to, here's how you modify its state.

sudo rstudio-server stop
sudo rstudio-server start
sudo rstudio-server restart

For more on managing RStudio server, see here, or the administrator guide.

Log in to RStudio Server

From the host-machine: point chrome to localhost:8787 and login with username and password vagrant/vagrant.

From any other machine: point chrome to mycomputername:8787 and login with username and password vagrant/vagrant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment