This page explains how to set up an empty virtualized environment for developing a drupal site.
- Virtualbox - Hosts virtual machines for sandboxing development environments
- Vagrant - Reproducible configuration and management for virtual machines
- Git - For setting up vagrant machines
- Clone the base vagrant repository
workstation:~$ git clone git@github.com:nsu/drupal-base.git
- Download the required virtual disk image
workstation:~$ vagrant box add chef/ubuntu-14.04
- Boot and provision the machine
workstation:~$ cd drupal-base/
workstation:~/drupal-base $ vagrant up
. . .
When the machine is booted for the first time it will also be 'provisioned'. The provisioning process will automatically install and configure everything that Drupal requires. Depending on the resources available to the virtual machine, this can take over 20 minutes. However, provisioning only needs to be done once.
- Test the machine
To test that the basic virtual machine was configured successfully, you can visit http://localhost:8080/. This should load the default drupal installation screen. You can also test from the command line interface. CURLing the address should return a 302 redirect to a 200.
workstation:~$ curl -IL http://localhost:8080/
HTTP/1.1 302 Found
Date: Mon, 28 Jul 2014 17:00:04 GMT
Server: Apache
X-Powered-By: PHP/5.5.9-1ubuntu4.3
Location: http://localhost:8080/install.php
Cache-Control: no-cache
Content-Type: text/html
HTTP/1.1 200 OK
Date: Mon, 28 Jul 2014 17:00:04 GMT
Server: Apache
X-Powered-By: PHP/5.5.9-1ubuntu4.3
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Mon, 28 Jul 2014 17:00:04 +0000
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
ETag: "1406566804"
X-Generator: Drupal 7 (http://drupal.org)
Content-Type: text/html; charset=utf-8
-
The
drupal-base/www
directory on the host is synchronized with the/var/www
directory on the guest. This is where drupal is served from by default. -
If you are not working on changing the
drupal-base
template repository, you should rename the directory and delete the github remote. e.g.workstation:~$ git clone git@github.com:nsu/drupal-base.git workstation:~$ mv drupal-base/ new-project/ workstation:~$ cd new-project/ workstation:~/new-project$ git remote rm origin
-
By default the guest is permitted to consume 2GB of Ram, 1 vCPU core and 1.5GB of host disk space (40GB guest). If these settings are too strenuous, they can be changed in the Vagrantfile, or through the virtualbox application.
-
This machine uses ports 8080 and 2222 on the host. If this causes conflict they can be easily changed using the
config.vm.network
settings in the Vagrantfile -
If changes need to be made to system-level configuration files, they should be done using Chef. If changes are made directly, without Chef, there is a chance that they will be overwritten if you choose to run
vagrant provision