Introduction

This tutorial will help you build your first development environment with Vagrant. As a bonus you will be able to play with a fresh Drupal 8 site. Please note, VDD works great with Drupal 6, 7 and 8.

Note

: Currently 8.x-2.x in version controle is the most up to date branch. A new release will be created soon. It has ubuntu xenial and php 7, that works with drupal 7 & 8.

Vagrant is a tool that automates the process of creating virtual machines with tools like Virtual Box or VMWare. You will not be working directly with Virtualbox when you are using the Vagrant tools, however. If you currently use Virtualbox on your development desktop and you are installing Vagrant on it, make sure to back up your Virtualbox installation and existing VM's.

Think of Vagrant as a rich set of tools/commands that automate Virtualbox to utilize it to its full potential as a development environment. When using Vagrant, you stop using Virtualbox directly. Virtualbox becomes a tool required by Vagrant and is controlled by Vagrant commands and configuration files.

VDD uses Vagrant and Chef Solo provisioner to configure and manage the virtualized development environment hosted on your OS (Windows, OSX, Linux) using VirtualBox. Before we begin, you need to install the required software.

To follow this tutorial you should also be (a little) familiar with the Terminal, since we will use text commands to control Vagrant.

Required software

VirtualBox

VirtualBox is a general-purpose full virtualizer for x86 hardware, targeted at server, desktop and embedded use.

Visit this page to install it. VDD should work with 4.0.x, 4.1.x, 4.2.x, and 4.3.x. versions. Don’t forget to install Oracle VM VirtualBox Extension Pack (also can be downloaded from the aforementioned page). Let’s check our version:

$ vboxmanage --version
4.3.10r93012

Vagrant

Vagrant allows you to create and configure lightweight, reproducible and portable development environments.

Look at this page to download and install it. Use Vagrant 1.5.4 or later. Let’s check whether Vagrant is installed correctly.

$ vagrant --version
Vagrant 1.5.4

Virtual Box & Vagrant on Windows 10

Windows 10 users have reported problems with the older Virtual Box and Vagrant Version mentioned above. These issues are unrelated to VDD and can be resolved by using the latest stable versions of Virtual Box and Vagrant.

Preparing VDD

Download VDD from the archive with the latest release and extract the contents into your home directory. Let’s rename the vdd directory to vdd_tour and look inside it:

├── Berksfile
├── Berksfile.lock
├── chef
│   ├── cookbooks
│   ├── data_bags
│   ├── roles
│   ├── shell
│   └── solo.rb
├── config.json
├── data
├── README.txt
└── Vagrantfile

At this point you only have to know about the config.json file. This is the main configuration file. Make sure to open and read the file, but don't edit the file not for now. By default config.json defines a Drupal 7 and a Drupal 8 site.

Building your environment

Now we are ready to start. To build your environment you only have to use one command. Make sure that you run the following command within your VDD directory (that is the vdd directory; now called vdd_tour).

$ vagrant up

At this point Vagrant will start downloading the Ubuntu 12.04 base box. Vagrant only has to do this once. Next time it will simply start to build your environment without downloading this Ubuntu base box again. (More about Vagrant base boxes can be found here).

After downloading the base box, Vagrant will read the Vagrant configuration (Vagrantfile) and start provisioning. (You will see a lot of green text messages). Be patient. You will have to wait approximately 5-10 minutes (depending on your network connection and your hardware). Be sure to disable any power-saving mode your computer or laptop has that may cause the system to go into a sleep state before the configuration has time to complete.

VDD uses Chef Solo provisioner to build the system. Chef is a systems and cloud infrastructure automation framework that makes it easy to deploy servers and applications to any physical, virtual or cloud location, no matter the size of the infrastructure.

Eventually you’ll see next lines:

==> default: [2014-05-23T04:57:43+00:00] INFO: Running report handlers
==> default: [2014-05-23T04:57:43+00:00] INFO: Report handlers complete
==> default: Running provisioner: shell...
    default: Running: /tmp/vagrant-shell20140523-12342-1w2ecda.sh
==> default: stdin: is not a tty
==> default: =============================================================
==> default: Install finished! Visit http://192.168.44.44 in your browser.
==> default: =============================================================

This means that your environment is ready. Hooray!

Note: if the install did not finish and provisioning with Chef throws errors please look at this comment and the subsequent replies.

Notice: There is a fix for Windows users with Vagrant 1.7.3 (and possibly other versions) when running $ vagrant up and failing to automount /var/www. Simply edit the linked file (located in Vagrant\embedded\gems\gems\vagrant-1.7.3\plugins\providers\virtualbox\driver folder.

Exploring your environment

Your development environment is ready. You can SSH into it by running the following command:

$ vagrant ssh

Let’s go into the /var/www directory and look around.

vagrant@vdd:~$ cd /var/www/
vagrant@vdd:/var/www$ ls
drupal7  drupal8  html

The drupal7 and drupal8 directories are contained within the /var/www directory. These directories were automatically created by VDD when you run $ vagrant provision

Drupal sites will live inside these directories.

Here is another way to locate the defined sites using Drush. VDD automatically creates site alias for every site defined in config.json file.

vagrant@vdd:/var/www$ drush site-alias --local-only
drupal7
drupal8

Ok. Fair enough. Let’s exit to our host machine.

vagrant@vdd:/var/www$ exit

Now we are on our host machine, inside the vdd directory. If we look at the data directory we will see the familiar drupal7 and drupal8 directories. It’s because the data directory is synchronized with your virtual machine (it is a shared folder). For example, if you put a file in the drupal8 directory, it will appear inside the virtual machine and vice versa.

Now open your browser and navigate to: http://192.168.44.44. You will arrive at the VDD landing page. Here you will find instructions on how to configure your hosts file in order to resolve your local drupal7.dev and drupal8.dev domains.

Installing Drupal 8

Let’s ssh into the virtual machine.

$ vagrant ssh

In the home directory, there is a sites folder. This is a symlink - a reference to another directory - to the /var/www directory. Running the following commands will clone and install a fresh Drupal 8 site.

cd ~/sites/drupal8
git clone --branch 8.0.x https://git.drupal.org/project/drupal.git .
drush @drupal8 si standard -y


Note the trailing period - the code will install in a sub-directory if you forget this period.

Congratulations! You’ve just installed Drupal 8. Visit http://drupal8.dev to play with it (here we assume that you’ve already configured your hosts file). If you haven’t configured your hosts file yet you can reach the site by navigating to http://192.168.44.44/drupal8.

Installing Drupal 7

cd ~/sites/drupal7
git clone --branch 7.x  http://git.drupal.org/project/drupal.git .
drush @drupal7 si standard -y

Why is Drupal working slowly?

You may notice that Drupal is working slowly. Don’t panic! VirtualBox shared directories are slow. We can fix the problem by using NFS synced folders. Unfortunately, NFS doesn’t work on Windows.

Here are some steps to help Drupal work faster.

1. Install the NFS server.

On Ubuntu:

apt-get install nfs-kernel-server

On MacOS 10.8.5: System comes with NFS installed. Just follow steps below to edit config.json and vagrant reload.

[TODO]: How to install NFS on other popular systems.

2. Change the type of synced folders to nfs in your config.json.

Find next lines inside your config.json.

  "synced_folders": [
    {
      "host_path": "data/",
      "guest_path": "/var/www",
      "type": "default"
    }
  ],

Replace default with nfs.

      "type": "nfs"

3. Run vagrant reload inside vdd_tour directory.

$ vagrant reload

You will be prompted to enter your password in order to mount folders.

Setup SSHFS on Windows.

1. Follow this link to see how to install it on Windows 8: SSHFS WINDOWS 8

2. Install vagrant-sshfs: vagrant plugin install vagrant-sshfs
Notice: There is an issue with automounting of vagrant folders (Error when mounting directory), we will use manual setup below.

3. Open Win-SSHFS and add a new drive. Enter your server’s connection details
NOTICE : Based on default vdd settings.

  • Drive name: "VDD"
  • Host: "127.0.0.1"
  • Port: "2222"
  • Username: "vagrant"
  • key-based authentication.
  • PrivateKey: [PATH_TO_USER_HOME_FOLDER]\.vagrant.d\insecure_private_key
  • Directory: "."
  • Drive letter: "X" (for example)

4. Press "Mount" button.

PS: Don't forget to unmount drive before you'll shutdown vdd.

Need more help?

VDD is a useful tool. It is simply the set of Chef cookbooks which build your Drupal development environment. If you encounter any problems feel free to ask for support on our IRC channel: (#drupal-vdd).

Connecting to the MySQL Database

Make sure you connect to the MySQL database of the Vagrant box using SSH.

MySQL Host: 127.0.0.1
Username: root
Password: root
Port: 3306 (default)

SSH Host: 192.168.44.44
Username: vagrant
Password: vagrant

Comments

michaelmallett’s picture

Might be worth noting in the steps that if postinstall.sh doesn't run (like it didn't for me) then running sudo sh postinstall.sh is needed.

Feel free to delete this comment if this is in the wrong place

mmcdougall’s picture

VDD 8.x-1.x-dev does not support the new VirtualBox 4.3.
One fix is to use VirtualBox 4.2 from here

danylevskyi’s picture

Why do you think so? What is your host OS?
I am using VirtualBox 4.3 with VDD and it works perfect.
Please, open an issue if you have some problems.

mmcdougall’s picture

If anybody would like to add more CPU cores with Vagrant here's how:

http://pastebin.com/8hAbiysR

    Notes:
  • set the desired number of cores in config.json (e.g. "cpus": "4")
  • the vb.customize ["modifyvm", :id, "--ioapic", "on"] setting is recommended here
btobolaski’s picture

You can but, you shouldn't. Virtualbox's multi cpu implementation is much slower than their single cpu. You will get better performance using only a single cpu.

danylevskyi’s picture

Do you have some links to a comparison tests?

justinlevi’s picture

I'd also like to see any documentation or data that backs this up. I've read about some specific cases where multiple cores seem to slow the guest runs slow but can't seem to find any recommendations to NOT use multi cores anywhere.

btobolaski’s picture

This is what I have been seeing with our Drupal stack, https://ruin.io/2014/05/05/benchmarking-virtualbox-multiple-core-perform...

nielvrom’s picture

I'm trying to connect to the host so I can see the database and export, ... .
I've tried to connect to 192.168.44.44 with username: root and password: root but with no success.

(I am sure that root, root and the ip is correct!)

This is the error:

Unable to connect to host 192.168.44.44 because access was denied.

Double-check your username and password and ensure that access from your current location is permitted.

MySQL said: Access denied for user 'root'@'192.168.44.1' (using password: YES)
sqndr’s picture

I had the same issue. Make sure you connect using ssh. I use Sequel Pro, here is my connection window: http://cl.ly/image/1e3L1B2l2y0c.

Hope this helps.

nielvrom’s picture

Thanks, that worked perfectly!

efficio’s picture

Whenever I try to use nfs type, I get these errors

==> default: ================================================================================
==> default: Error executing action `create` on resource 'directory[/var/www]'
==> default: ================================================================================
==> default:
==> default:
==> default: Errno::EPERM
==> default: ------------
==> default: Operation not permitted - /var/www
==> default:
==> default:
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-2/cookbooks/vdd/recipes/apache.rb
==> default:
==> default:   1: directory "/var/www" do
==> default:   2:   owner "vagrant"
==> default:   3:   group "vagrant"
==> default:   4: end
==> default:   5:
==> default:
==> default:
==> default:
==> default: Compiled Resource:
==> default: ------------------
...
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

I think it is related to user and group permissions.

My host is OSX.

I try some configs with bindfs, but couldn't make it work.

Any clue?

chrisclark’s picture

It seems to work fine if you leave it as default for the first time, then changing to nfs and then reload.

f0ns’s picture

Also had this issue: every time I need to vagrant provision I have to put default instead of nfs, then provision and after provisioning was successfull I can put it back to nfs and then vagrant reload.

Kinda weird but this is the workaround.

rhuffstedtler’s picture

If you get the error "Cookbook paths not loaded", this is a known issue with a simple workaround. See: https://www.drupal.org/node/2278423

Mark_L6n’s picture

In the 'Required Software' section, it says: 'Don’t forget to install Oracle VM VirtualBox Extension Pack'. Is this actually necessary? I have not seen instructions for this on other 'how to' pages, and even the Vagrant install page doesn't mention it. What are the VDD-related capabilities that this adds?

danylevskyi’s picture

It's something related to NFS.

Anonymous’s picture

It is optional as to whether you install the Extension Pack or not. It provides for

  • Support for a virtual USB 2.0 controller (EHCI)
  • VirtualBox RDP: support for proprietary remote connection protocol developed by Microsoft and Citrix.
  • PXE boot for Intel cards
awm’s picture

Can I customize the box so it checks out custom git repo's? Also, where can I found the documentation about the specs of the Box that comes with VDD?

gateway69’s picture

Fresh Ubuntu 14.04, virtual box 4.3xxx, latest vagrant.. downloaded the dev vdd.. ran it and this spit out at the end.

[default] Running provisioner: shell...
[default] Running: /tmp/vagrant-shell20141020-7618-xjignr
stdin: is not a tty
+--------------------------------------+
| |
| ooooo oooo ooooooooo ooooooooo |
| 888 88 888 88o 888 88o |
| 888 88 888 888 888 888 |
| 88888 888 888 888 888 |
| 888 o888ooo88 o888ooo88 |
| |
+--------------------------------------+Updating Chef to 11.12.4 version. This may take a few minutes...
[default] Running provisioner: chef_solo...
Generating chef JSON and uploading...
Running chef-solo...
stdin: is not a tty
[2014-10-21T02:24:54+00:00] FATAL: Configuration error NoMethodError: undefined method `ssl_verify_mode' for main:Object
[2014-10-21T02:24:54+00:00] FATAL: /tmp/vagrant-chef-1/solo.rb:24:in `load'
[2014-10-21T02:24:54+00:00] FATAL: /tmp/vagrant-chef-1/solo.rb:24:in `from_string'
[2014-10-21T02:24:54+00:00] FATAL: Aborting due to error in '/tmp/vagrant-chef-1/solo.rb'
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

rpsu’s picture

Please do open an issue if you experience any problems: https://www.drupal.org/project/issues/vdd - that is the right place for problems.

--
Perttu Ehn

infinet’s picture

Hi

I'm attempting to follow the instructions above for setting up Win SSHFS.

I've completed the 4 steps I am updating the config.json to reflect the changes.

Should it just be:

"synced_folders": [
    {
      "host_path": "data/",
      "guest_path": "/var/www",
      "type": "sshfs"
    }
  ],

I have mounted the drive as X:

Cheers

infinet’s picture

To complete I did the following:

Keep the synced folder settings for now and while logged in to the Vagrant VM copy the site folders to the VM file system. (e.g copy /var/www to /var/www2)
Then remove the synced folder config lines in config.json.
Then renamed www2 to www.

Now you can view your sites at /var/www as before except those files are on the VM filesystem instead of a synced folder.
You can access the files in Windows using the Win SSHFS mounted drive.

Cheers

dhigby’s picture

So many complaints on Windows about sluggishness including my own experience. So, I commented out all the shared folder references in Vagrant file and in config.json
Vagrantfile Synced folders section now reads:
# Synced Folders.
end
# Run initial shell script.

and config.json modded to read:
"synced_folders": [],

Now lightening fast. I don't want the shared folders anyway, can do everything via ssh.

exorsyst’s picture

I tried these mods and executed vagrant reload, but the web server doesn't start. It looks like it's still trying to mount shared folders from the guest side. Do we have to rebuild the server?

Thanks.

RaSpirit’s picture

Not sure if someone will care about it, but I'm not able to use drush in vdd with drupal 6, I'm gettings errors like user_load_by_mail() is undefined and user_load_by_name() is undefined, which actually are not present in drupal 6.

--
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Call to undefined function Drush\User\user_load_by_name() in /usr/local/bin/drush-master/lib/Drush/User/UserVersion.php, line 34
Drush was not able to start (bootstrap) Drupal.

RaSpirit’s picture

Not sure what caused this but I fixed it per suggestion in https://github.com/drush-ops/drush#install---manual 3.iii. So I'm still able to use drush 7 if needed.

highermath’s picture

This is usually caused by a database transfer that renunbers user 0 to something else. In drush 6, there is a useful error message. In drush 7, you get the cryptic error you reported.

defconjuan’s picture

Some of our devs run Windows 8, what's the purpose of installing SSHFS on Windows? I'm not sure I understand why you'd need to mount the filesystem over SSH the vdd_tour\data\drupal7 and vdd_tour\data\drupal8 are both accessible to Windows without SSHFS.

rhuffstedtler’s picture

Hi vtldevops,

I think the main rationale would be that virtual box shared folders are appallingly non-performant on Windows. I've experimented with winsshfs, but I'm not completely happy with it. It doesn't always handle symlinks correctly and there seem to be some subtle issues. If I use eclipse with a workspace in the sshfs mount it doesn't reliable write the workspace metadata.

There isn't (to my knowledge) a good nfs option for Windows, or that would be my preference.

I've thought about using virtual box shared folders for the provisioning and then Samba for any actual operations where I needed to do stuff on the VM, but I haven't experimented with that yet.

Johnnie Walker’s picture

Just thought it worth mentioning. I have been using shared folders on VMware Player (community/free version) on Windows XP for years and had no noticeable issues with speed. At time of writing, the community edition of VMware Player does not act as a provider for vagrant (you have a buy a different VMware product for vagrant integration). But, it shows the VMware seem to have cracked the shared folders issue.

Neil_Nand’s picture

Hello,

I'm very new to Vagrant but think I've mostly got this up and running but am having problems working with the database.

I've tried using PHPmyadmin to import a database file I exported from a current Drupal site but every time I try I just get an error message stating "No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration." The thing is though the compressed version of the file is around 13MB & the uncompressed version is 137MB, I tried both, but PHPmyadmin says that the maximum is 500MB so they cannot be to large. The file name also only has three characters, no special ones, then the .sql extension.

The other problem I'm having is connecting using MySQL Workbench, I enter in all the credentials but then keep getting prompted for the password, I keep typing in "root" but it doesn't seem to work.

Any help would be very helpful,
Thanks.

robbdavis’s picture

@niel_nand there is a bug in the chef recipe for phpmyadmin. The patch is available here. This cost me hours and hours trying to figure it out before I found the thread. Hopefully the patch is added to an update soon.

https://www.drupal.org/node/2281929#comment-9457285

Reno Greenleaf’s picture

Please note, VDD works great with Drupal 6, 7 and 8.

Does it? VDD uses PHP 5.4 now. Drupal 6 works with 5.2 and 5.3.

Anonymous’s picture

Absolutely fantastic job! Really well done.

I might suggest that you look at using vagrant plugins (visit https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins for more information). For example, on all our machines we use the vbguest plugin, which checks that the guest matches the VirtualBox Guest Additions of the host (very important).

Running plugins is very simple and is only run from the host NOT from the guest. If you are running Vagrant 1.42 or higher you need only enter

vagrant plugin install

followed by the plugin name you wish to install. So to install the vbguest plugin we would run

vagrant plugin install vagrant-vbguest

You can simplify the NFS installation by vagrant-nfs_guest and you can even do vagrant-winnfsd -- NFS support for Windows hosts. You may need to install the vagrant-omnibus Chef plugin first, if you encounter any problems.

TheSteveLavigne’s picture

I have been testing this system and it worked well for a whole day of testing and now, all of a sudden, I can getting the following error:

The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

It always appears at the same location during 'up'.

==> default: +--------------------------------------+
==> default: | |
==> default: | ooooo oooo ooooooooo ooooooooo |
==> default: | 888 88 888 88o 888 88o |
==> default: | 888 88 888 888 888 888 |
==> default: | 88888 888 888 888 888 |
==> default: | 888 o888ooo88 o888ooo88 |
==> default: | |
==> default: +--------------------------------------+
==> default: Updating Chef to 11.12.4 version. This may take a few minutes...
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Any insight on what this may be would be great.

Cheers!

anthonyf’s picture

I got this same error after installing VirtualBox, Vagrant, and VDD (according to the instructions on this page) on Mac, and ran 'vagrant up' for the first time. I stopped the virtual machine in VirtualBox Manager, then removed it completely, electing to delete all files when prompted. I then ran 'vagrant up' again, and it proceeded past the "Updating Chef" step and seemed to be running fine, but it eventually failed again with different errors.

The solution came when I realized that my laptop has a power-saving "sleep" mode, and that it had probably gone into this mode before the script completed both times. Before trying again, I turned off the sleep mode to make sure my laptop would stay up. Once again, I stopped the running virtual machine, and removed it completely in VirtualBox Manager. Then I ran 'vagrant up' again. This time the whole script completed without error.

mike421’s picture

I also get exactly this error on windows 10 after a new clean install of Vagrant and Virtualbox, did you ever find out why? It is not due to "sleep" as suggested below.

joshua.boltz’s picture

Thanks for the tip.
I too needed to manually run the sudo sh postinstall.sh to complete the process.

8thom’s picture

If you're looking for a quick way to get a Drupal 8 Vagrant dev environment up take a look at this -- https://github.com/thom8/drupal8-vagrant

It uses a pre provisioned box so no need for anything other than Vagrant and Virtualbox - it also installs Drupal 8 during "vagrant up".

However, you can't edit the provisioner as it is built into the base box but there's a config.yml file which has some customisable options.

jlmeredith’s picture

I performed a fresh install of VDD and had issues with "vagrant provision" working as I expected and this tip fixed it for me. http://stackoverflow.com/a/28145459

it seems like there is a bug with sync folders, this clears the cache and fixed it for me. (from your project directory)

rm .vagrant/machines/default/virtualbox/synced_folders
vagrant reload --provision
https://github.com/mitchellh/vagrant/issues/5199

--
Jamie Meredith

MikeiLL’s picture

Just tried the latest stable VDD and development VDD version, which seem to be configuring the box to use PHP 5.4.4.

When trying to install Drupal 7 (git clone --branch 7.0.x http://git.drupal.org/project/drupal.git .), getting this message: Your PHP installation is too old. Drupal requires at least PHP 5.5.9. See the system requirements page for more information.

baisong’s picture

Here's what I got:

vagrant@precise32:~/sites/drupal8$ git status
# On branch 8.0.x
nothing to commit (working directory clean)
vagrant@precise32:~/sites/drupal8$ drush @drupal8 si standard -y
You are about to create a /var/www/drupal8/sites/default/settings.php file and DROP all tables in your 'drupal8' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a while. Consider using the --notify global option. [ok]
exception 'Drupal\Core\Installer\Exception\InstallerException' with message 'PHP: 5.4.43-1+deb.sury.org~precise+1 [error]

Your PHP installation is too old. Drupal requires at least PHP 5.5.9.' in /var/www/drupal8/core/includes/install.core.inc:2292
Stack trace:
#0 /var/www/drupal8/core/includes/install.core.inc(1016): install_display_requirements(Array, Array)
#1 /var/www/drupal8/core/includes/install.core.inc(650): install_verify_requirements(Array)
#2 /var/www/drupal8/core/includes/install.core.inc(528): install_run_task(Array, Array)
#3 /var/www/drupal8/core/includes/install.core.inc(117): install_run_tasks(Array)
#4 /usr/local/bin/drush-master/includes/drush.inc(720): install_drupal(Object(Composer\Autoload\ClassLoader), Array)
#5 /usr/local/bin/drush-master/includes/drush.inc(705): drush_call_user_func_array('install_drupal', Array)
#6 /usr/local/bin/drush-master/commands/core/drupal/site_install.inc(78): drush_op('install_drupal', Object(Composer\Autoload\ClassLoader), Array)
#7 /usr/local/bin/drush-master/commands/core/site_install.drush.inc(289): drush_core_site_install_version('standard', Array)
#8 [internal function]: drush_core_site_install('standard')
#9 /usr/local/bin/drush-master/includes/command.inc(359): call_user_func_array('drush_core_site...', Array)
#10 /usr/local/bin/drush-master/includes/command.inc(210): _drush_invoke_hooks(Array, Array)
#11 [internal function]: drush_command('standard')
#12 /usr/local/bin/drush-master/includes/command.inc(178): call_user_func_array('drush_command', Array)
#13 /usr/local/bin/drush-master/lib/Drush/Boot/BaseBoot.php(62): drush_dispatch(Array)
#14 /usr/local/bin/drush-master/drush.php(70): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#15 /usr/local/bin/drush-master/drush.php(11): drush_main()
#16 {main}
vagrant@precise32:~/sites/drupal8$

Urmel’s picture

I tried the same today, simply copying the instructions for Drupal 8 (which does need a higher php version) and exchanging 7 for 8. But then I saw a message on the command line that branch 7.0.x does not exist so instead it checked out HEAD which is 8.0.x.

Here is a list of existing branches: http://cgit.drupalcode.org/drupal/refs/heads. But you can also see them if you do a:
git branch -a

The fix is simply to go into your drupal 7 directory and type:
git checkout 7.x

Then you have a Drupal 7 that is happy with the installed php.

cobblestone.consulting’s picture

One other option to addressing the slow performance using Windows as a host OS is to install smbclient and cifs-utils on the guest OS and mount the /var/www folder using smb.

ericjenkins’s picture

I followed the comment by @Eric-Seifert in node 2180527 and simply changed the 'default' synced_folders type to 'smb' in my config.json file, and I am now running VDD with the smb file system. I didn't have to install anything extra to make it work. Performance does seem better than 'default' file system, but I'm very new to VDD so it's hard to say.

dstorozhuk’s picture

How should I update config.json to build more than one drupal 7 installation?

Drupal support and development https://itech4web.com

Anonymous’s picture

I have the same question. Have updated config.json and followed this tutorial https://groups.drupal.org/node/464533. No success

GodsGiftToDrupal’s picture

Hi,

I am new to Drupal and VDD. I managed to get VDD working on my computer, using the defaults it came up with, except that I used nfs.

I already have a dedicated server running Debian/Jessie (that's Debian 8.2). If I want my virtual box to be running Debian/Jessie too, can I just replace Ubuntu trusty in the configuration files with Debian/Jessie, or would I have to change other things in the configuration files too. In other words, do the configuration files contain things (other than the Ubuntu/trusty specification) that are specific to Ubuntu/trusty, and that wouldn't work as is on a Debian/Jessie ?

I am asking for both the current release and for future plans.

tce’s picture

Did you ever get an answer to this?

MarkU’s picture

......do the configuration files contain things (other than the Ubuntu/trusty specification) that are specific to Ubuntu/trusty, and that wouldn't work as is on a Debian/Jessie ?

takirami’s picture

Trying to get the hang of this. I followed the steps to set up an environment for drupal8.
However, I'm having issues with the php version. When running php -v in the terminal the prompt returns the version 5.5.9-ubuntu4.13 but when printing out the phpinfo on the drupal index page it states that the php version is 5.4.45-2+deb.sury.org~precise+2. Why do the versions differ?

dawid_nawrot’s picture

Sorry to say but this box doesn't work anymore. The newest version of Drupal 8 requires minimum PHP 5.5.9 and for best experience PHP 5.6. The version of PHP provided with this box is 5.4.45:

vagrant@precise32:~/sites/drupal8$ php -v
PHP 5.4.45-2+deb.sury.org~precise+2 (cli) (built: Oct 4 2015 16:13:43)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans

So it needs to be updated if you want to run Drupal 8 on this envioment. Besides, it's also warns about the branch that doesn't exists:

warning: Remote branch 8.x not found in upstream origin, using HEAD instead

Any update? Is dev version includes PHP >= 5.5.9 ?

EDIT
DRUPAL 8 CAN BE INSTALLED WHEN USING dev VERSION OF PROJECT.

poupouxios’s picture

Hi,

For people who want to create a Drupal 7 or Drupal 8 project on their local machine, I created an easy way on Linux to just setup some configuration variables and with a vagrant up you have a Drupal instance to play.

You can find an example of sample project on https://github.com/poupouxios/drupal-vagrant and how to create your own . Any comments appreciated :)

Thanks.

geerlingguy’s picture

See also, many of the alternatives to VDD that also use Vagrant: https://www.drupal.org/vi/node/2256789

__________________
Personal site: www.jeffgeerling.com

jmm42’s picture

Hey guys,

I've been working on a vagrant implementation of drupal 7, within centos 7x. It is a fully functional drupal-demonstration, and only needs to be cloned, then issued the vagrant up command to build. Remember, like any drupal installation, you'll need the database information. This can be found within the following:

Though, for some of you: by the time you read this, it is likely I've restructured my puppet implementation, into puppet modules. So, I'd use the authenticated sql user, and the corresponding password, password (that shouldn't change). Also, this repository, implements selinux, and forwards any http requests to the ssl equivalent.

But, I have not provided any sort of stigging for this environment, since Redhat/Centos 7x has not officially provided stig guidelines. I hope this repository is beneficial to people. If not, feel free to post issues.

Thank you!

Martin Mayer’s picture

The private key for the SSHFS access is not as described in
PrivateKey: [PATH_TO_USER_HOME_FOLDER]\.vagrant.d\insecure_private_key

If I use that I get an access denied message. Using the vagrant ssh-config command shows that /vdd/.vagrant/machines/default/virtualbox/private_key is used.

trompe’s picture

When I try drush @drupal8 si standard -y

I get this error message:
[error] Could not find the alias @drupal8

My config.json is correct (I think):

{
  "vm": {
    "ip": "192.168.44.44",
    "memory": "1024",
    "synced_folders": [
      {
        "host_path": "data/",
        "guest_path": "/var/www",
        "type": "nfs"
      }
    ],
    "forwarded_ports": []
  },
  "vdd": {
    "sites": {
      "drupal8": {
        "account_name": "root",
        "account_pass": "root",
        "account_mail": "box@example.com",
        "site_name": "Drupal 8",
        "site_mail": "box@example.com",
        "vhost": {
          "document_root": "drupal8",
          "url": "drupal8.dev",
          "alias": ["www.drupal8.dev"]
        }
      },
      "drupal7": {
        "account_name": "root",
        "account_pass": "root",
        "account_mail": "box@example.com",
        "site_name": "Drupal 7",
        "site_mail": "box@example.com",
        "vhost": {
          "document_root": "drupal7",
          "url": "drupal7.dev",
          "alias": ["www.drupal7.dev"]
        }
      }
    }
  }
}

Why drush not recognize aliases? It's a fresh VDD installation...

digitaldonkey’s picture

No site Aliases defined and @self dosn't work on a fresh install.

Diego Balboa’s picture

jmm42’s picture

Hey guys, I've updated my drupal-demonstration repository. As it was before, install the following:

- vagrant (with extension pack)
- virtual box

Then, all you have to do is clone the drupal-demonstration, into your machine, and execute vagrant up. This will provision a nice centos 7x (with selinux enabled) virtual machine, with a fully functional drupal 7 instance, via a custom drupal install profile, provisioned by puppet. This means, if you have additional modules, or themes, or site configuration(s) that need to be enabled, or adjusted during install, this is where to define it.

Not only is the drupal install automated, but I configured a redis-server (again automated with the build) to do database caching. So, your local drupal website, will notice a significant (and noticeable) performance boost, compared to the previous iteration of the drupal-demonstration.

You really don't have to do anything, just download two things, issue the vagrant up command, then visit your nice drupal sandbox, configured with a self-signed certificate at https://localhost:6656.

ragavendra_bn’s picture

hi, Is there documentation for hosting an existing drupal 7 website or multisite on vagrant.

jmm42’s picture

I wouldn't consider Vagrant necessarily for production use, personally. Typically, production environments use one of the following approaches:

- vSphere
- KVM
- OpenStack

Therefore, something like vagrant is redundant on one of those implementations - since virtualization on hardware is faster, so virtualizing on software is a redundancy. Vagrant in my opinion is containerization tool for a devOps team to simulate some environment. At some point, I will be doing nested containerization. This means, I will nest a bunch of docker containers within my vagrant implementation. The docker containers will be recycle-able, since I think in the near future hardware virtualization will support docker, if they don't already.

But, I'm still trying to grasp the concept of docker containers, with a focus of integrating automated builds via travis CI, for automated unit testing:

- https://github.com/jeff1evesque/machine-learning/issues/2628#issuecommen...

ragavendra_bn’s picture

ohh sorry, my bad, I shouldn't have mentioned website, I actually meant hosting a multi site installation .....

jmm42’s picture

Yes, there are multiple ways. I'm not 100% knowledgeful of this module in context of your goal. However, if you know linux, and some knowledge of a provisioning tool (i.e. puppet), you could streamline the multi-site installation. For me, I've only streamlined the drupal install profile, for a single drupal instance via puppet:

- https://github.com/jeff1evesque/drupal-demonstration/tree/master/webroot...
- https://github.com/jeff1evesque/drupal-demonstration/blob/master/puppet/...

ragavendra_bn’s picture

ohh sure, I already setup the instance on drupalvm and working with it for a while, one more thing I noticed is the module's latest version was like 2 years ago and may be when precise was there and now we have the latest ubuntu, I guess its always not clean to work around these versioning ......

jmm42’s picture

My Vagrantfile calls on a custom vagrant box:

- https://github.com/jeff1evesque/drupal-demonstration/blob/2e39c90e2858dc...

which is stored on Atlas's repository:

- https://atlas.hashicorp.com/jeff1evesque

But, I could easily swap my box for the latest Ubuntu:

- https://atlas.hashicorp.com/ubuntu/boxes/trusty64

Though, my provisioning would probably break, since I'm premised on Centos (which has different implications). So I guess what I mean is, I could easily swap it out for the latest Centos 7.x:

- https://atlas.hashicorp.com/centos/boxes/7

ragavendra_bn’s picture

ohh cool, that's worth noting, also vdd seems to be pretty nice and straight forward for one to easily start with ...... I guess even multi site install is possible by setting the ip in the hosts file on the host machine which I should have tried ......

anthonyf’s picture

I recently went through the steps listed here to install the latest (as of July 18, 2016) VDD on Mac El Capitan, and ran into issues. I'm posting a quick solution here so you don't have to go searching if you want to get this running quickly.

The release version fails on Chef provisioning steps.
The Dev version gets farther along in the provisioning process but also fails before completing. Since Dev gets farther before failing I stuck with that version. It was erroring out while installing Mailcatcher. Since I don't need Mailcatcher in my local dev, I followed BigEd's steps to remove it from the recipe. After removing Mailcatcher the provisioning completed successfully.

Also, the Drush command listed in the documentation to install Drupal (I'm installing Drupal 8) doesn't work as stated. I looked into using Drupal Console for a quick installation, but that gives you a site which uses SQLLite with the default PHP web server. Since I wanted to use the Apache server and MySql, which are included in the VDD virtual machine, I decided to stick with Drush. The install command that worked for me was as follows. First, follow the documented instructions for cloning a fresh version of Drupal 8 into the ~/sites/drupal8 directory. Then, in the same directory, run something like this:

drush site-install standard --db-url=mysql://[dbUser]:[dbPassword]@localhost/drupal8 --account-name=admin --account-pass=[acctPassword] --site-name=My_D8_Site

The alias for the site-install command is 'si', if you're into shorter commands.
Replace [dbUser] with the database user ID, which is 'root' by default.
Replace [dbPassword] with the database user password, which for the root user is also 'root'.
Replace [acctPassword] with the password you want to use for the admin Drupal user account.
'localhost' is the database host
'drupal8' is the name of the database. If you use a different database name, go into mysql and create it, then specify that name here instead.
I didn't find a way to include spaces in my --site-name value. It didn't recognize single or double quotes, so I had to use a one-word name. Probably better to just add the name manually, after the site install.

If you do the site install like that, it will create a settings.php file for you.

The instructions for enabling NFS worked as stated.

*Addition - When I ran the same Vagrant recipe on my work MacBook (which worked on my personal MacBook), it failed with a different issue. It was a 404 error in chef provisioning with a “node not found” message. I learned this is caused by a bad (or mismatched) chef version, and some users had gotten around it by installing an earlier version. So I added the following to my Vagrantfile under
config.vm.provision :chef_solo do |chef|
chef.channel = "stable"
chef.version = "12.10.24"

This caused chef version 12.10.24 to be installed when it got to that point in the Vagrantfile, and then it completed provisioning successfully. I tried changing the config in chef/shell/initial.sh to install chef 12.10.24 but that caused another failure on ruby version, so I left initial.sh as it was and kept the extra chef install in Vagrantfile as stated above.

Here is the (rather hacked-up) version of VDD I ended up with on GitHub: https://github.com/ajfwebdev/vdd_ajf

pv1’s picture

Thank you. You saved the day!!

The release version also fails on Chef Update. So moved on with the dev version.

Applied this patch in order to keep MailCatcher.

Also problem with drush aliases. Fixed it in the guest with

cp /usr/local/bin/drush-master/aliases.drushrc.php ~/.drush/

Bertjuh’s picture

Great! Thanks! By using both you guys' solutions I got it working. Although the instructions in the original page are not too self explanatory for this noob. Your patches and tips should be edited into the page content directly.

griddick’s picture

Hi all,
Recent changes to the repository for PHP and difficulties in getting VDD to work pushed me to spend a few hours in front of the PC trying to get it working.
A few more hours than expected later, I ended up with an attempt to move to LTS16.04 and PHP7. No promises that it will work for everyone but it has allowed me to carry on Drupal development (I think) if I come across any other issues over the next week I will try and push them here: vdd_gr

felipecabral’s picture

Hi mr. Graeme Riddick! I tried your Vagrant/Chef solution to deploy a drupal7 dev enviroment and it worked fine for me. Thank you.

ps: I realized two small (and potentially important) details: you didn't mention the vagrant-hostsupdater plugin and your readme is not a .md file . So, I made a pull request into your github repo changing this.

griddick’s picture

Glad to hear that my changes worked and happy to integrate the improvements thanks.

awm’s picture

I have also been taking my time working on an update. Just pushed 8.x-2.x. We are looking for feedback: https://www.drupal.org/project/vdd/issues/2915293

awm’s picture

I have also been taking my time working on an update. Just pushed 8.x-2.x. We are looking for feedback: https://www.drupal.org/project/vdd/issues/2915293

pyim’s picture

I follow this page tutorial. The Download VDD link actually gave me an error below.

default: Updating Chef to 11.12.4 version. This may take a few minutes...
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

That is because the Download VDD link is pointing to the outdated VDD project page.

I found the right link to the most updated VDD project. https://www.drupal.org/node/2008018/git-instructions/8.x-2.x

Download that and did vagrant up, no errors.