How I build an Ubuntu 10.04 LTS Drupal Development VM in VirtualBox

Posted by Jeff Beeman on Wed, 08/11/2010 - 07:22

A development virtual machine can be really handy. It gives you a sandbox of sorts where you can feel free to test and experiment knowing that in a worst-case scenario you can just delete the VM and start over. It can also be a great way to practice server configurations and sketch out "real-world" server setups. Here's the process I follow to setup my Ubuntu 10.04 LTS Drupal development VM in VirtualBox. Aside from the VM-specific steps, these instructions should work for a regular Ubuntu server (VM or not).

Download and install Ubuntu 10.04

Note: Unless otherwise specified, all commands below should be run on the guest VM (Ubuntu).

If you haven't do so already, download and install VirtualBox. Then, download the Ubuntu 10.04 LTS disk image to your host computer.

Next, Create a new virtual machine in VirtualBox. Be sure to select type of "Linux" and OS Type of "Ubuntu" and 32 or 64 bit, accordingly.

Start the machine and, when prompted to select a disk drive, click the icon to the side and open the Virtual Media Manager. Add the ISO file you downloaded to the list of disk images and select it as the media to mount. Walk through the install wizard. When asked to install software, don't choose any packages. We'll add them later. When asked to install the GRUB boot loader, go ahead and choose "yes." Once installation is complete, click on the CD icon in the VM window and unmount the disk image, then choose "Continue" to reboot into the Ubuntu server VM.

Update, upgrade, and setup SSH

Before we do anything else, let's get comfortable in the environment. Working in the small shell window that VirtualBox provides isn't ideal, and it'd be nice to be able to do the rest of the setup over SSH in the terminal of our choice. Install the OpenSSH Server package, upgrade existing packages and then shutdown the server (because we'll have likely updated "linux-headers-server" and other core OS packages, and also so we can do the next step).

If you'd like to make things easier on yourself and not have to type "sudo ..." for every command, run sudo -u root -s to become root for the rest of the session. Otherwise, be sure to add "sudo" before each of the follwing commands.

apt-get install openssh-server apt-get update apt-get upgrade apt-get dist-upgrade shutdown -h now

Get in the habit of running apt-get update and apt-get upgrade regularly. It's one way you keep your Ubuntu server patched and secure! apt-get dist-upgrade should be run if you see "The following packages have been kept back..." when you run apt-get upgrade. This means that some packages haven't been upgraded because they involve core, operating system-level updates that require a restart of the machine.

Configure networking on the host machine

On the host machine, run the following commands below. The first line sets up a handy environment variable you can use later. Just replace "Ubuntu 10.04 LTS" with whatever name you gave your VM when setting it up in VirtualBox. The commands below assume you haven't changed your network adapter type in VirtualBox from the default. If you have, you'll likely need to change the device name.

ubuntu_vm="Ubuntu 10.04 LTS" VBoxManage setextradata "$ubuntu_vm" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/Protocol" TCP VBoxManage setextradata "$ubuntu_vm" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/GuestPort" 22 VBoxManage setextradata "$ubuntu_vm" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/HostPort" 2222 VBoxManage setextradata "$ubuntu_vm" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guesthttp/Protocol" TCP VBoxManage setextradata "$ubuntu_vm" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guesthttp/GuestPort" 80 VBoxManage setextradata "$ubuntu_vm" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guesthttp/HostPort" 8888

Now, start the VM back up. You should now be able to SSH into your Ubuntu VM as follows:

ssh localhost -p 2222

Install Apache, PHP and MySQL

Now, install some generally useful packages that will be used for the rest of the process.

apt-get install build-essential git-core subversion cvs python-software-properties curl

Before we get to the web server setup, we need to change Ubuntu's package definitions a bit. Ubuntu 10.04 LTS is configured to pull PHP 5.3.x, but many Drupal 6.x contrib modules aren't compatible with PHP 5.3, so we need to downgrade to PHP 5.2.x. We'll follow some instructions from Khalid at 2bits. We'll take his Approach #3 by adding Ralph Janke's PHP 5.2 repository for Lucid and "pinning" the PHP version to 5.2, to make sure we don't inadvertantly upgrade to 5.3 (I've provided the apt preferences file in my Github repository, for easy access).

add-apt-repository ppa:txwikinger/php5.2 wget -O /etc/apt/preferences.d/php apt-get update

Now, we'll install the web server, PHP packages (including APC), and MySQL. Please note that you'll be prompted for a MySQL root user password. The last command below also disables some unneeded Apache modules and enables a few that are good to have for Drupal.

apt-get install apache2 php5 php5-cli php5-gd php-pear php5-dev apache2-dev apt-get install mysql-server php5-mysql a2dismod cgi autoindex a2enmod deflate expires rewrite vhost_alias pecl install apc

Configure Apache and PHP

Update PHP settings by editing both /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini and setting the variables below as shown:

safe_mode = Off expose_php = Off memory_limit = 128M display_errors = Off log_errors = On
error_log = /var/log/php/php.log ; (or php_cli.log)

Update APC settings by editing /etc/php5/conf.d/apc.ini: apc.enabled=1 apc.enable_cli=1 apc.shm_segments=1 apc.shm_size=32 apc.cache_by_default=1 apc.stat=1

Create the error log files:

mkdir /var/log/php touch /var/log/php/php.log touch /var/log/php/php_cli.log chown -R www-data:www-data /var/log/php chmod -R 0755 /var/log/php

Due to the way Drupal handles URLs, in particular how it handles creating a URL to itself, we need to tell Apache to listen on port 8888. This gets around the "HTTP Request Fail" issue in the status report, among other things:

Edit /etc/apache2/ports.conf and add Listen 8888, so that the beginning of the file looks like:

NameVirtualHost *:80 Listen 80 Listen 8888

Install and configure Drush

Setup Drush and Drush Make to be used server-wide. The commands below grab the latest verison as of this writing, but you can check the Drush and Drush Make project pages to see if there are newer releases:

cd /usr/local/src wget wget tar xzf drush-6.x-3.3.tar.gz tar xzf drush_make-6.x-2.0-beta8.tar.gz mkdir /etc/drush cp /usr/local/src/drush/examples/example.drushrc.php /etc/drush/drushrc.php ln -s /usr/local/src/drush/drush /usr/local/bin/drush

Edit /etc/drush/drushrc.php to add Drush Make to include path:

$options['i'] = '/usr/local/src/drush_make';

Install Drupal

Create a database, download, and install Drupal (be sure to put a password in for the MySQL grant statement where appropriate below). I like to keep my sites in sub-directories of /var/www. These commands will prepare Apache for that working setup. I've provided a couple of files that are downloaded with wget to make this simpler, but feel free to modify them along the way if you wish.

mysql -u root -p -e "CREATE DATABASE drupal_dev; GRANT ALL PRIVILEGES ON drupal_dev.* TO [email protected] IDENTIFIED BY 'password'; FLUSH PRIVILEGES;" wget -O /var/www/drupal-demo.make wget -O /etc/apache2/sites-available/drupal-demo a2dissite 000-default a2ensite drupal-demo chown -R www-data:www-data /var/www sudo -u www-data drush make /var/www/drupal-demo.make /var/www/drupal-demo sudo -u www-data cp /var/www/drupal-demo/sites/default/default.settings.php /var/www/drupal-demo/sites/default/settings.php /etc/init.d/apache2 restart

Walk through Drupal's install wizard by visiting http://localhost:8888. Once you're done, run the following Drush command to quickly enable the modules in the demo site:

cd /var/www/drupal-demo drush en -y admin \ content content_copy fieldgroup filefield imagefield nodereference \ number optionwidgets text userreference bulk_export ctools \ ctools_custom_content page_manager views_content path search devel \ features imageapi imageapi_gd imagecache imagecache_ui masquerade \ pathauto skinr strongarm token panels_mini panels_node panels \ jquery_update vertical_tabs views views_bulk_operations views_export \ views_ui fusion_core


You're done! From here, you've got a fully-functional Ubuntu virtual machine designed for developing Drupal sites.


There are some issues to work out and other tasks to add to these instructions. Any feedback on these items would be greatly appreciated.


  • Drupal reports that it can't make HTTP requests, but it can. I believe this is because we're making requests over port 8888, but Drupal thinks it's running on port 80. Not sure how to get around this, but also not sure it's really all that important for development environments.


  • TODO: Install and configure Aegir
  • TODO: Install and configure Varnish
  • TODO: Install and configure Solr


Decoder Ring: a framework for collaborative language research

Posted by Jeff Beeman on Wed, 06/09/2010 - 13:58

This spring, I wrapped up my masters degree in Educational Technology at Arizona State University. In my studies, I had the great pleasure of working with some of the trailblazing academics in the field of educational language, literacy, and gaming studies. Among the folks I've interacted with over the last several years, James Paul Gee and Elisabeth Hayes have overwhelmingly influenced my interests in academic research in the field. Guided by their seminars and publications, along with many others, including Sean Duncan and Constance Steinkuehler, I developed a strong interest in utilizing my web application development skills to create tools that further the field of academic research in language and literacy.

Last fall, I started in earnest on a project to do just that and, to make a long story very short, the ultimate result is Decoder Ring, which I've just presented at the 2010 Games, Learning & Society Conference. Decoder Ring is a web-based, collaborative language analysis tool designed for academic research of textual content. It features:

  • Abstracted, flexible, powerful data model
  • Sustainable, low cost, open source framework
  • Project- and group-based to facilitate collaboration
  • Tools for gathering (scraping), importing, browsing, and exporting large data sets
  • Automated and extensible reporting tools

I'm still working on the user-facing documentation side of things, but if you're interested in reading a bit more about it, please visit If you'd like to learn more, please take a look at the slides for my presentation at the 2010 Games, Learning and Society Conference and contact me if you'd like to learn more, including about how to gain access.

Open source

If you know anything about me, you'll know that I'm a staunch advocate of open source, both as a philosophy and as a business model. Decoder Ring is built upon the Drupal framework and the wealth of community modules and themes available for it. All of the Drupal-related code I've created for it is available on my Github page, and I'm working on releasing more of it over the coming weeks.

Here's a list of the technologies that make up the Decoder Ring platform:

Attachment Size
Decoder Ring.pdf 6.45 MB

DrupalCon San Francisco 2010 Presentation: Drupal at ASU - Slides and video

Posted by Jeff Beeman on Wed, 04/28/2010 - 09:40

I recently presented a session titled Case Studies in Academia: Drupal at ASU & Johns Hopkins Knowledge for Health at DrupalCon San Francisco 2010. The presentation went really well. It was great to meet with all the other universities that are using Drupal and talk about the wildly varying ways Drupal is being used in academia.

If you'd like to watch the video recording, it's available on or on the DrupalCon presentation page. The slides for the presentation are attached below.

Rewrite Amazon product links using jQuery, RegEx and PHP

Posted by Jeff Beeman on Sun, 11/22/2009 - 20:56

Over at Gamers With Jobs we wanted to rewrite any outbound Amazon product links so that they include the GWJ affiliate ID (every little bit counts when you're a community site). Deciphering Amazon's generally bloated URLs can be tricky, as can knowing what exactly is required when building a link to a product page. So, I cobbled together a couple different pieces of info into a pretty simple solution that I thought I'd share.

First, we wanted a redirect page that would allow us to get metrics on how many product links are followed on our end. This was super-easy to implement in PHP, thanks to a script from Blogthority.

$asin = htmlspecialchars($_GET['asin']);
if ($asin) {
$link = "" . $asin . "?tag=your-affiliate-id-here";

The trickier part was getting any pre-existing Amazon links, along with any links that users don't enter in the local redirect format, to be rewritten. A bit of jQuery and a JavaScript regular expression, inspired by a post over on MusicBrainz, made a quick solution.

Note: If you're using the latest jQuery, you'll want to drop the @ symbol from the initial selector.

$('a[ @href *= "" ]').each(function() {
var href = $(this).attr('href');
var re = /\/([A-Z0-9]{10})(\/|\?|\b)/i
var asin = re.exec(href);
if (asin[1]) {
var shorturl = '/go/amazon?asin='+asin[1];
$(this).attr('href', shorturl);

The script grabs any links with "" in the URL and rewrites them to follow our redirect page using the 10 digit ASIN that it pulls using a regular expression. That's it!

(Finally) rid of that ugly theme

Posted by Jeff Beeman on Sat, 08/08/2009 - 09:33

I've hated my personal site's theme for a couple of years now. Cleaning it up has been sitting a few items down on my todo list for a long time, and I finally decided to stop waiting for a good time and just move it up the stack this week.

Old site design

I tried out a couple of starter Drupal themes (Ninesixty and Blueprint) but found them light on documentation and simply not as "complete" as my stand-by on nearly every site, Zen. I was adventurous and went for the 6.x-2.x-dev version of Zen, which has some really nice changes under the hood. The dev branch's documentation still needs some updating, but my familiarity with the theme helped me quickly overcome any issues I encountered.

New site design
Fewer viewers report wanting to throw up in their mouths when viewing this theme.

My main goal with the new theme was to get a more clean, readable, and more timeless look. I essentially don't want to have to update my site's theme anymore... at least, not unless one of my far-more-talented-than-me graphic designer friends want to help me out with it. *wink-wink* *nudge-nudge*

I'll be going through old posts and cleaning them up as-needed to make everything fit within the new size restrictions, but that may take a few days.


[Updated] Upgrading your site to Drupal 6.x: Handout for July 2009 ASU Drupal Users Group

Posted by Jeff Beeman on Thu, 07/23/2009 - 07:31

[Update] I've updated the handout to be a single page, cleaned-up a lot of the instruction, and fixed several typos. Please see the revised handout below.

An additional note: If you use the handout to assist your site upgrade process, please do me a favor and fill out a brief survey.

Original post:

Attached below is the handout from the July 2009 ASU Drupal Users Group workshop. Use this handout to help you cover all the steps necessary to upgrade your site from Drupal 5.x to 6.x. It contains a module inventory worksheet and a site review checklist that can be used to help you make sure your site is fully functional after the upgrade.

Note: I created this handout for the ASU DUG workshop as well as an assignment for one of the courses I'm in at ASU. If you use the handout as an aid when performing a site upgrade, please let me know so that I can send you a link to a brief survey about your experience with it. The survey will help me get a better understanding of how you used the handout and how it can be improved.

Attachment Size
Drupal-5to6-Walkthrough-Revised.pdf 110.11 KB

Slides for April 2009 ASU Drupal Users Group

Posted by Jeff Beeman on Thu, 04/23/2009 - 10:12

Attached below are the slides for the April, 2009 ASU Drupal Users Group presentation I gave on maintaining sites using a combination of CVS (to checkout Drupal core and contrib modules) and Subversion (for backing up your site's code base and integrating with locally maintained modules and themes).

Here's a quick rundown of links mentioned in the presentation:

Read on after the break for code samples.

A quick reference for the shell scripts we created (OS X):

Create or update ~/.bash_profile

export PATH=$PATH:/usr/local/bin

Bash script for checking out Drupal core

Create the shortcut command, drcvs_core in /usr/local/bin/:

cvs -z6 -d:pserver:anonymous:[email protected]:/cvs/drupal co -d $1 -r DRUPAL-$2 drupal

Make the file executable:

chmod ugo+x /usr/local/bin/drcvs_core

Bash script for checking out Drupal modules

Note: Be sure to make the bash script executable (see above).

Create the shortcut command, drcvs_module in /usr/local/bin/:

cvs -z6 -d:pserver:anonymous:[email protected]:/cvs/drupal-contrib checkout -r DRUPAL-$2 -d $1 contributions/modules/$1

Bash script for checking out Drupal themes

Note: Be sure to make the bash script executable (see above).

Create the shortcut command, drcvs_theme in /usr/local/bin/:

cvs -z6 -d:pserver:anonymous:[email protected]:/cvs/drupal-contrib checkout -r DRUPAL-$2 -d $1 contributions/themes/$1

Bash script for cleaning up for Subversion after a CVS update

Note: Be sure to make the bash script executable (see above).

Create the shortcut command, drcvs_cleanup in /usr/local/bin/:

for FILE in `svn status $1 | grep '?'`; do svn add $FILE; done;

for FILE in `svn status $1 | grep '!'`; do svn rm $FILE; done;

Sample usage

Checkout Drupal core from CVS and commit to Subversion

cd /path/to/subversion/branches/folder

drcvs_core cvs-demo 6-9
svn add cvs-demo

svn commit -m "Adding drupal core for cvs demo site"

Checkout modules from CVS and add to Subversion

cd sites/all/modules

drcvs_module cck 6--2-2

drcvs_module views 6--2-4

drcvs_module cvs_deploy 6--1-0
svn add *

svn commit -m "Add CCK, Views and CVS Deploy modules"

Checkout a theme from CVS and add to Subversion

drcvs_theme zen 6--1-0
svn add zen

svn commit -m "Add Zen theme"

Updating Drupal core or modules from CVS

cd /path/to/drupal

cvs up -dP -r DRUPAL-6-10

drcvs_cleanup .

svn commit -m "Update to Drupal 6.10"

cd /path/to/views

cvs up -dP -r DRUPAL-6--2-5

drcvs_cleanup .

svn commit -m "Update to Views 6.x-2.5"

Telling Subversion to ignore files

cd /path/to/sites/default

svn propedit svn:ignore .

# Add ‘settings.php’ to the first line of the file and save it

svn commit . -m "Ignore settings.php"

Referencing an external Subversion project

cd /path/to/themes

svn propedit svn:externals .

Add the following to new line(s) in the file


Retrieve the external project and commit the change

svn up

svn commit -m "Add external reference to ASU Zen theme"

Attachment Size
ASU DUG - SVN and CVS.pdf 1.33 MB

ASU-style custom Gmail theme

Posted by Jeff Beeman on Thu, 04/02/2009 - 16:53
ASU Gmail theme

I thought I'd share my recipe for a nice, clean Gmail theme with Arizona State University colors that you can use on your ASU Gmail account. Open up your Gmail (especially your ASU Gmail if you're at ASU) and go to Settings > Themes > Choose your own colors. In the window that pops up, enter the following:

Main Background
Background color: #FFFFFF
Text color: #666666
Link color: #990033

Background color: #990033
Text color: #FFFFFF
Link color: #FFCC00

Background color: #666666
Text color: #000000

Background color: #FFFFFF
Text color: #000000
Snippet text color: #999999

Selected Message
Background color: #FFCC00

Slides for March 2009 ASU Drupal Users Group

Posted by Jeff Beeman on Thu, 03/26/2009 - 14:26

Attached below are the slides for the March, 2009 ASU Drupal Users Group presentation I gave. The presentation contains info on the following topics:

DrupalCon 2009: Washington, DC



Miscellaneous Links

Attachment Size
ASU DUG - DCDC CAS FeedAPI.pdf 374.35 KB

Spring 2009 Video Games, Learning and Literacy

Posted by Jeff Beeman on Sat, 01/24/2009 - 10:02

I've been really quiet for the last several months, but just wanted to drop a quick line and say I'm helping out with the Video Games, Learning and Literacy class I took last spring. Among other things, I've setup a site for the class that we're using in place of Blackboard. I used Drupal and, while it's still under pretty heavy construction theme-wise, the site should prove to be a great resource for the students. Check out the Spring 2009 VGLL site, if you're interested.

Subscribe to Home