Bitnami LAMP Virtual Machine Stack using VirtualBox for Drupal development

Work Local with your favorite editor or IDE! Then deploy wherever

I have previously written about the great Kalabox dev environment which is especially useful in the development process if you are using Pantheon hosting. When you install that, you automatically get VirtualBox installed.

Using VirtualBox you can work with other cool virtual machine images, like Bitnami, for example. In this article we learn how to setup a no-nonsesense Lamp virtual machine using the Bitnami LAMP Stack Virtual Appliance riding on VirtualBox, with no-nonsense virtual host based Drupal instances accessible anywhere on your network, and you can use a best-practices based process workflow with an Ubuntu server running right on your Windows, Mac or Linux laptop.

Quo vadis? Native Installer or Virtual Machine?

Downloading and unpacking

Creating the virtual machine instance

Login and configuration

Installing drush

Take a snapshot and stop the virtual machine

Set up Drupal Instances with Drush and Virtual Hosts, not Bitnami Drupal modules

Quo vadis? Native Installer or Virtual Machine?

Bitnami offers quite a few stacks, which can be enriched by modules, as well as straight-up applications. And many are offered in two varieties:

  • As a native installer, which is a single click affair, running as an independent self-contained application on either Windows, Mac or Linux, with its own directory structure and other conventions. It is the easiest way to get started with a single click.

  • As a virtual machine, making you free as a lark, but with a certain amount of sysadmin responsibility.

The Drupal application comes in both varieties, but since I was interested in working with multiple drupal environments I decided to go with the Lamp Stack app, and as a virtual machine for maximum flexibility.

Then I could develop without an internet connection and use my favorite local IDE or editor (Atom these days!).

Downloading and unpacking

You have to go through an albeit simple signup process to download anything (Bitnami's business model is to get you to use their Cloud console which makes it a snap to, say, deploy a locally developed virtual machine based Drupal site to Amazon cloud), but I downloaded the LAMP stack virtual machine (note: NOT the native installer single click app) from the appropriate download page. Since Kalabox had already downloaded its image to /Users/victorkane/VirtualBox VMs, I unpacked the LAMP stack zipped file there (it isn't just a single click binary executable like the native installers).

Creating the virtual machine instance

I followed the instructions in the support section User's Guide, “How to start your Bitnami Virtual Appliance”. Here is what I did:

  • I unpacked the downloaded “Virtual Appliance” file into /Users/victorkane/VirtualBox VMs/bitnami-lampstack-5.4.28-0-ubuntu-12.04

  • I started up VirtualBox and clicked the New icon and following the instructions at entered:

    • Name: BitnamiLampVM

    • Type: Linux

    • Version: Ubuntu (64 bit)

    • Hit Continue.

    • I gave it 2048 MB memory (the same as Kalabox)

    • Hit Continue

    • Selected the option “Use an existing virtual hard drive file” and clicked on the folder browse icon and then navigated to and opened the file /Users/victorkane/VirtualBox Vms/bitnami-lampstack-5.4.28-0-ubuntu-12.04/bitnami-lampstack-5.4.28-0-ubuntu-12.04.vmdk

    • Hit Create

    • I clicked on the Network configuration section, and changed the Attached to option to "Bridged Adapter"

    • And there it was. The newly created BitnamiLampVM virtual machine was selected, so I hit the Start icon.

    • The login shell came up with info items telling me that Auto capture keyboard was on, and that I could uncapture keyboard strokes by pressing the Host Key (shown in the status bar); and that the mouse pointer integration feature was supported by Mac OS (thank goodness).

Login and configuration

    • At the Linux login prompt I entered username bitnami and password bitnami. I was then prompted to change the password.

    • I was in.

    • Use sudo where necessary in normal operations. If you really need root, you can do “sudo -i” or “sudo su” and become root. No password required for root, and you never need to login as root. If you want to you can become root and then use the passwd command to create a login password for root.

  • Access server via assigned IP

    • I determined the virtual machine's unique IP on the network

      $ ifconfig
      eth0      Link encap:Ethernet  HWaddr 08:00:27:f7:5b:0f  
                inet addr:  Bcast:  Mask:
    • I was then able to access the http server from anywhere in the local network

    • I enabled ssh and logged in using a regular Mac terminal bitnami@

        $ sudo mv /etc/init/ssh.conf.back /etc/init/ssh.conf
        $ sudo start ssh
  • I copied my public key into a newly created authorized_keys file in a newly created /home/bitnami/.ssh directory and was able to ssh in without login

  • Stuff was up and running

      bitnami@linux:~$ php --version
      PHP 5.4.28 (cli) (built: May  2 2014 10:18:00) 
      Copyright (c) 1997-2014 The PHP Group
      Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
      bitnami@linux:~$ git --version
      git version 1.9.0
  • I enabled remote access to phpmyadmin

    • I edited /opt/bitnami/apps/phpmyadmin/conf/httpd-app.conf

      • On line 20 I changed “Allow from” to “Allow from all”

      • On line 24 I changed “Require local” to “Require all granted”

    • I restarted Apache the Bitnami way

        $ cd /opt/bitnami
        $ sudo ./ restart apache
        Syntax OK
        /opt/bitnami/apache2/scripts/ : httpd stopped
        Syntax OK
        /opt/bitnami/apache2/scripts/ : httpd started at port 80
    • I accessed phpmyadmin in the browser at By default the username is root and the password is bitnami

Installing drush

bitnami@linux:~$ sudo -i
[sudo] password for bitnami: 
root@linux:~# pear channel-discover 
Adding Channel "" succeeded
Discovery of channel "" succeeded
root@linux:~# pear install drush/drush
downloading drush- ...
Starting to download drush- (505,989 bytes)
.....................................................................................................done: 505,989 bytes
install ok: channel://
root@linux:~# drush
root@linux:~# exit

Take a snapshot and stop the virtual machine

You can take a snapshot from the VirtualBox Manager window. Click on Snapshots and then click on the Take Snapshot icon.

I stopped the virtual machine from the command-line:

$ sudo shutdown -h now

The VirtualBox Manager showed the virtual machine as Powered Off

Set up Drupal Instances with Drush and Virtual Hosts, not Bitnami Drupal modules

Unless you are going to be using dyndns or a dedicated IP with a registered domain, just do the same as Kalabox, setting up an editable hostname, which can be modified each time a different IP is assigned to the virtual machine. Place the following into your /etc/hosts file (Linux, Mac...):

# Bitnami vm's bitnamilampvm drupal01.bitnamilampvm

If you want you can reserve an IP in your local router, then assign it:

$ sudo ifconfig eth0 netmask up 

You can then access the web application from any computer of your network at

Grab Drupal

All Drupal instances will be subdirectories of the bitnami user.

$ cd
$ drush dl
tput: unknown terminal "xterm-256color"
Project drupal (7.28) downloaded to /home/bitnami/drupal-7.28.         [success]
$ mv drupal-7.28/ drupal01

Set up for install as usual

Set up the database with phpmyadmin

See instructions for exposing phpmyadmin above, and create a database and user with all privileges to that database.

Create the Virtual Host

In order to enable virtual hosts, edit /opt/bitnami/apache2/conf/httpd.conf, and uncomment the include directive for the virtual hosts file:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Once that is done, you can go ahead and edit /opt/bitnami/apache2/conf/extra/httpd-vhosts.conf to include your virtual hosts. Note that Require all granted is necessary instead of Allow from all as of Apache 2.4. Example:

<VirtualHost *:80>
 ServerName drupal01.bitnamilampvm
 DocumentRoot /home/bitnami/drupal01
 <Directory "/home/bitnami/drupal01">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   Require all granted

Then restart apache to enable:

$ cd /opt/bitnami
$ sudo ./ restart apache

You're on! Install Drupal

Point your browser to http://drupal01.bitnamilampvm/ and go to town!