Drupal Association members fund grants that make connections all over the world.
Some Forks Are Used For Good, Not Evil
This is a fork of the Drupal Vagrant project. But this fork isn't born of ill will. Rather, it is designed to provide recipes specific to the book Learning Multi-Site Drupal.
This will create a full Ubuntu Linux server running as a virtual machine on your computer, preconfigured for running a Drupal multi-site (lots of sites on one installation of Drupal).
Before installing, you will need to do the following:
- Install VirtualBox. You will need a recent (>4.08) version.
- Install Vagrant.
- Get this project from Drupal.org (Instructions). You will need Git for this step.
Once you have VirtualBox, Vagrant, and this project, you are ready to start the installation process.
- At the command line, go into the directory for this project:
$ cd multisite_vagrant/
- If you haven't done so in the past, get the base Ubuntu Lucid image for vagrant:
vagrant box add base http://files.vagrantup.com/lucid32.box
- Tell Vagrant to build you a shiny new virtual machine:
By the time you've freshened up your coffee (or grabbed an Oreo milkshake), Vagrant should have downloaded, installed, and configured a new box for you. It will have: A minimal version of Ubuntu Linux, Apache 2.2, MySQL 5.1, PHP 5.3, Drupal 7 and some basic modules. It will also have some useful debugging tools like Xdebug and xhprof. Memcache and Varnish can be "turned on" with just a tiny bit of configuring.
Accessing Your Awesome New Server
Your new virtual machine lives on your local host, and you can access it in the following ways:
Some of the files on your virtual host are transparently shared with your host computer. If you are in the
multisite_vagrant directory, all of the data you see there is shared with your virtual machine. A change to one of these files here will be immediately available to the virtual machine.
Issue this command from your terminal:
$ vagrant ssh. This will connect you to your new Drupal server. Go to
/vagrant/public to see the files directory that is shared with your local host. The rest of the stuff is stored in its normal Linuxy place.
(Did I mention that Drush is installed for you?)
Assuming you installed the site exactly as it is (without editing the
Vagrantfile), this virtual host is configured to listen on the address
126.96.36.199 (or sometimes
188.8.131.52 -- this makes it easier to run regular Drupal Vagrant at the same time) for three domain names:
Lest you be perplexed about the names, these are the names used in the book.
You will want to edit your local hosts file, adding this to the bottom:
184.108.40.206 books.local cooks.local looks.local
You should definitely tinker around with this thing. Here's the 30 second tour:
Vagrantfileis your friend. Read it. Try stuff. It is the master configuration file.
- Want different sites than books, cooks, and looks? Just edit
Vagrantfile. Then you will need to run this command to rebuild your virtual machine:
vagrant provision. That command is very helpful.
- When you build a box, Vagrant runs one or more roles. The roles are configured in the
Vagrantfileand stored in the
roles/directory. By default, this module runs the role called
- Vagrant runs this thing called chef, which is a piece of software used for build management and delivery. Appropriately, chef uses recipes to figure out what it's doing. These are stored in cookbooks, and they are called from roles (the same roles I mentioned before). You'll need to learn about some of this stuff if you want to tinker a lot. The documentation at http://vagrantup.com is very good.
chef.add_recipe("drupal::install_multisite")Did you see this line in your Vagrantfile? Comment it out and Drupal won't be installed. You'll have a server all ready, and you can fiddle with it however you want. Or you can edit the recipe itself. It lives in
cookbooks/drupal-cookbooks/drupal/recipes/install_multisite.rb. Also take a look at the
example.rbrecipe (from Drupal Vagrant) to see another way of building out a site.
- DO IT AGAIN!:
vagrant destroynukes your virtual machine.
vagrant uprebuilds it again from scratch. It's fun. I highly recommend it.
- Or you can stop your VM exactly where it is, and start it up again later:
vagrant suspend, grab milkshake, come back,
And a word to the wise: If you're doing something important, DON'T put the only copy inside of your VM. At least keep another copy locally.
This project is just a fork of the main Drupal Vagrant project. It's forked not because I'm trying to do anything better, but because I wanted to provide a stable build as a companion for the MultiSite book.
If you do awesome stuff with this and want to contribute it back, you're welcome to send it my way. You might also consider working on the real Drupal Vagrant project. Many people will thank you for it.