Chapter Three LLC

HOWTO: Keeping Drupal on Your Keychain

Matt Cheney

I am sure it’s a common problem. You are a rocking Drupal software engineer and you are talking to a particular cute guy or girl at a pretty awesome party. Naturally, the conversation turns to open source software projects and you boast that you work on Drupal - the coolest content management system out there. Since this boast is bound to be followed up with questions like “what is Drupal?” or “why is Drupal cool?” - wouldn’t it be grand (instead of trying to explain just how cool the garland color picker is) to whip out a portable USB key, stick it in an available computer, and show them the wonders of Drupal right then and there?

Install Ubuntu onto a USB Key

  • Download Ubuntu and mount [mount -o loop ] the image
  • Use fdisk [fdisk /dev/sda] to delete any existing partitions [fdisk: d], add a new partition [fdisk: n,p,1,*enter*,+700M], set its type to FAT16 [fdisk: t,6], and make it active [fdisk: a, 1], add another partition [fdisk: n,p,2,*enter*,*enter*], and save all the changes [fdisk: w]
  • Install the FAT16 filesystem [mkfs.vfat -F 16 -n usb /dev/sda1] and the ext2 filesystem [mkfs.ext2 -b 4096 -L casper-rw /dev/sda2]
  • Install the Linux System Tools [syslinux -sf /dev/sda1]
  • Mount the USB Key [mount /dev/sda1 /mnt] and copy over Ubuntu [cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus /mnt]
  • Copy this special file to the USB key [tar xf usyslinux.tar ; cp syslinux.cfg /mnt]
  • Run Lilo [lilo -M /dev/sda]

These instructions and system file are adapted from this tutorial. For the purposes of these directions the USB drive is assumed to be at /dev/sda.

Install and Configure the LAMP Stack

  • Install the stack [apt-get install php5-mysql mysql-server php5 apache2]
  • Enable Apache’s mod-rewrite [ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load]
  • Allow .htaccess overrides in apache’s configuration file [vim /etc/apache2/sites-available/default] by changing all “AllowOverride None” configurations to “AllowOverride All”
  • Edit your /etc/rc.local file [vim /etc/rc.local] to add the following line [mount /dev/sda2 /mnt], run the command on the command line [mount /dev/sda2 /mnt], and add a web root directory [mkdir /mnt/webroot]
  • Edit the Apache configuration file to point to your new webroot [vim /etc/apache2/sites-available/default] to change all references to /var/www to /mnt/webroot. ** Note - its important to setup a separate webroot on the ext2 system since apache is not a fan of the FAT16 filesystem **

Install and Configure Drupal

  • Create your MySQL database [mysql -u root], set the appropriate permissions, and copy over your Drupal database (or install a new one)
  • Copy over the Drupal code files to your webroot at /mnt/webroot
  • Do any other Drupal configuration needed

Set up “Kiosk Mode” in Linux

  • Create a shell script [vim /home/ubuntu/kiosk.sh] to execute [/usr/bin/firefox —fullscreen http://127.0.0.1] ** Note - sometimes it takes a second for apache to load and the script may need “sleep 30” at the beginning to give apache time to load **
  • Configure Ubuntu at (System —> Preferences —> Sessions) to run the kiosk.sh script at Startup
  • Install the AutoHide Firefox Extension
  • Add a line [rm /home/ubuntu/.ICE*] to your GDM runtime to remove ICE Authority File Locking Issues [vi /etc/gdm/PreSessions/Default]

To boot off of the USB key, insert the USB key into a computer and set its BIOS to boot from the USB key. Wait a couple of minutes for it to boot up and enjoy the Drupal.

Drupal On a Stick

We have really enjoyed Drupal on a stick (http://www.ratatosk.net/software/onastick/) When I last checked the 5x version was throwing some errors but the 4.7 version was fantastic. I need to look at 5.x again. No need to boot off the key chain. Just plug it into any windows box and it will run right away. I recommend getting firefox on the stick (http://portableapps.com/apps/internet/firefox_portable) if you really want to blow her mind with your drupal install. She will end up buy you the drinks ;)

Posted by Eric (not verified) | May. 22nd, 2007 @ 2:24pm | Link to this Comment

there’s also Mamp for mac

there’s also Mamp for mac os X, and I believe XAMPP has now caught up with the Mac scene. Not sure if there’s a portableApps equivalent for mac though…

Posted by Anonymous (not verified) | May. 22nd, 2007 @ 9:37am | Link to this Comment

Why in your pocket?

I thought this was gonna be about something fun, like a drupal keyring. Why would you want to go through all that hassle, when drupal is all over the internet? Unless your party is in some remote location (in which case there’s probably not a computer anyway) then the computer at the party is more than likely connected to the web…

There’s an online demo at opensourceCMS.com

Posted by Anonymous (not verified) | May. 22nd, 2007 @ 9:36am | Link to this Comment

drupal on XAMPP

I also tried XAMPP, but I tried it with the PortableApps launcher (http://portableapps.com/suite) - which makes it all a bit more complicated to install, but in the end should be easier to run..

Unfortunately I failed to start mysql: PortableApps XAMPP on Windows Vista will not work out of the box yet because of those pesky UAC issues.

Posted by ontwerpwerk (not verified) | May. 22nd, 2007 @ 5:34am | Link to this Comment

Thanks for showing the linux

Thanks for showing the linux way with the configs and all. The weakness is in the sentence “set its BIOS to boot from the USB key”. I (despite breathing fedora and kubuntu) walk with a windows setup on my stick without an OS. My clients all seem to have ancient machines which strain to crank the lampp or with Mac machines for which I have no setup (is it easy to run the ubuntu_lampp on Mac?). Otherwise they are firewalled and proxied without the permissions to tweek hosts or proxy settings and exceptions let alone edit the BIOS. There seems to be no average situation to cook up a druaplified usb. Is your ubuntu setup the future of crossplatforming light-to-run lampp? It’s certainly swish and very helpful info

Posted by Anonymous (not verified) | May. 22nd, 2007 @ 5:21am | Link to this Comment

Or, an even easier way

For people with Windows computers, just load the WAMP package: xampp onto the usb key using their zip file install, then install drupal. Works like a champ.

Posted by zoon_unit (not verified) | May. 22nd, 2007 @ 5:12am | Link to this Comment

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <br/> <br /> <p> <img> <blockquote> <i> <b> <u>
  • Lines and paragraphs break automatically.
  • SmartyPants will translate ASCII punctuation characters into “smart” typographic punctuation HTML entities.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options