Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've got a devbox VM running via vagrant and virtualbox. I'd like to have it just run as a web server and do all my work on my local machine (where my dev tools are).

I've seen this done before, where the VM has an application folder that points to the host machine's folder, and whenever changes are made on the local machine (i.e. via Sublime/vim) they are automatically updated on the VM.

The VM is running a Heroku image (which I believe runs on Ubuntu). The host machine is also Ubuntu 13.04

share|improve this question

1 Answer 1

up vote 1 down vote accepted

By default, Vagrant will share your project directory (the directory with the Vagrantfile) to /vagrant.

In your Vagrantfile, you should have the following

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

  config.vm.synced_folder "src/", "/srv/website"
end

NOTE: The first parameter is a path to a directory on the host machine. If the path is relative, it is relative to the project root. The second parameter must be an absolute path of where to share the folder within the guest machine. This folder will be created (recursively, if it must) if it doesn't exist.

Other options

Option 1

Recommended sshfs Install sshfs package, mount a path on the host via ssh, for example, mount the $HOME/project to /srv/www on the guest

sshfs user@host:~/project /srv/www

To unmount sshfs

fusermount -u /mnt/sshfs

/srv/www on the guest appears as if it is local.

Option 2

NFS See => Vagrant - NFS

share|improve this answer
    
thanks, this is just what I was looking for. –  patrickgamer Jul 23 '13 at 16:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.