Check your version
This tutorial covers a topic in which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of , but we consider it archived.
Typically when we work with a Web server, we edit our files locally, and then "push" them up to our Web server (perhaps using SCP, rsync, Git push, or maybe even FTP). The same will be true with our Vagrant server: you need a way to get files from your host machine, to the guest server. You could either use SCP, but we will enable file sharing to make life a lot easier. With file sharing enabled you will be able to drap-and-drop files into specific directories within your Vagrant instance using your local file manager (e.g. Finder or Windows Explorer). The files will be immediately shared, and recognized by your server, allowing you to continue working on the files with your favorite IDEs and code editing tools without the upload step. Technically, enabling file sharing isn't necessary, but I think you'll agree it is a lot more convenient than SCPing files to your guest server.
By the end of this lesson you will be able to share files between your host and guest machines without the use of SCP. After enabling file sharing, you should be able to copy a file into the shared folder in your Vagrantfile and have it automatically appear inside the Vagrant instance. e.g. you can load a static web page created on your local machine without having to use SCP.
As long as you're using basic file sharing (no NFS), it should work "out of the box" for Windows 8, and OSX.
- Configure synced folder in Vagrantfile.
- Locate and remove:
# config.vm.synced_folder "../data", "/vagrant_data"
- In its place, add:
config.vm.synced_folder "docroot", "/var/www"
- Create a new directory using the name identified in the file Vagrantfile.
$ mkdir docroot
- Reload the vagrant instance (and restart the server). The contents of
/var/wwwwill appear in
$ vagrant reload
$ vagrant ssh
$ sudo /etc/init.d/apache start
- Edit the Web page from the host machine.
- Refresh the browser to see the changed file.
This lesson was recorded using VirtualBox 4.3.6 and Vagrant 1.4.3. There is a known issue for file sharing with VirtualBox 4.3.10. If you get the following error message: "Failed to mount folders in Linux guest. This is usually because the "vboxsf" file system is not available." you have encountered this bug. Consider downgrading VirtualBox to 4.3.8, or follow the troubleshooting tips in the issue queue for your particular host machine.
If you are having problems with file permissions / ownership, try editing the permisisons from the host machine, not the guest machine. This is most noticeable when you are creating a new Drupal instance and there are folders / files created automatically by the system. Vagrant won't give a warning to explain why it won't change permissions, it simply doesn't show any changes after running chommands such as:
chmod +w <directory_name>.
If you are still having problems with silent file permissions, update your Vagrantfile as follows:
- Locate the setting for
- Add a server-friendly owner, by adding the following to the end:
, :owner => "www-data"
- Add a server-friendly group, by adding the following to the end:
, :group => "www-data"
If you're STILL having problems, update your Vagrantfile to give more permissive defaults.
- Locate the setting for
config.vm.synced_folderand add the following to the end:
, :mount_options => ['dmode=775', 'fmode=664']
- The final line should be something like this (all one line):
config.vm.synced_folder "docroot", "/var/www", :owner => "www-data", :group => "www-data", :mount_options => ['dmode=775', 'fmode=664']
Over the years we've developed some techniques for practicing that we wanted to share. At Drupalize.Me we take hugging seriously. In this tutorial we'll look at the art, and science, of giving a good hug. The Merriam Webster dictionary defines the word hug as; squeeze (someone) tightly in one's arms, typically to express affection.
Did you know there are all kinds of different hugs that you can give? In this tutorial we'll look at:
- Defining what a hug is
- Some of the many types of hugs in the world today
- Precautions you may want to familiarize yourself with before hugging
- And the importance of proper technique
Lets go ahead and get started shall we?