Karl Kedrovsky

A Server VM For Drupal Development

For some time now I've wanted to have a way for to do Drupal development locally without all the platform specific issues (especially on Windows) that constantly plague folks just starting Drupal development. I've been thinking that setting up a VM using VirtualBox might be a good solution so I gave it a try.

Goals

High Level Steps

Installing and Configuring VirtualBox

I'm assuming you can install VirtualBox and can run through the basic set up of a new VM. The only thing "odd" with the VMs we'll set up here is the network interface.

Installing Ubuntu

I used Ubuntu 12.04 and everything from here on assumes that you did too.

Installing The Software Stack

Setting Up The Host Only Network Interface

Setting Up Host File System Access

Configure The Mail Server

The following come from http://www.lucidlynx.com/how-to-install-postfix-to-relay-mail-through-gmail-in-ubuntu. I use Google Apps so my gmail address is karl@kedrovsky.com, just use your Google Apps or Gmail address in place of that one below. Configuring this bit can be pretty tricky, google is your friend...

  1. Modify /etc/postfix/main.cf.

    Update the relay_host line so that it looks like this:

    relayhost = [smtp.gmail.com]:587
    

    {: .language-bash }

    Comment out the following lines:

    mailbox_command = procmail -a "$EXTENSION"
    default_transport = error
    relay_transport = error
    

    {: .language-bash }

    Add the following to the end of the file:

    smtp_tls_loglevel = 1
    smtp_tls_security_level = encrypt
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
    smtp_sasl_security_options = noanonymous
    smtp_generic_maps = hash:/etc/postfix/generic
    

    {: .language-bash }

    For reference, my entire main.cf looks like this:

    # See /usr/share/postfix/main.cf.dist for a commented, more complete version
    
    # Debian specific:  Specifying a file name will cause the first
    # line of that file to be used as the name.  The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname
    
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h
    
    readme_directory = no
    
    # TLS parameters
    smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
    smtpd_use_tls=yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    
    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.
    
    myhostname = drupal
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    mydestination = drupal, localhost.localdomain, localhost
    relayhost = [smtp.gmail.com]:587
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    # mailbox_command = procmail -a "$EXTENSION"
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = loopback-only
    inet_protocols = all
    # default_transport = error
    # relay_transport = error
    
    smtp_tls_loglevel = 1
    smtp_tls_security_level = encrypt
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
    smtp_sasl_security_options = noanonymous
    smtp_generic_maps = hash:/etc/postfix/generic
    

    {: .language-bash }

After all that you'll have a server that's all set up for Drupal development. Exactly how you go about using it is up to you but I'll describe how I do thing in my next blog post.