I followed this article for running a Firefox-based test framework on a server earlier this year. The Xvfb-stuff is pretty simple, we just need to make sure to turn the access controls off so X doesn't get all uppity. Something like this should get you going:
sudo apt-get install xvfb
sudo Xvfb :10 -ac
# run your gubbins
Though you should note that this isn't going to provide everything a real desktop session has. If you ever get into that situation (where you need a real desktop) it might be worth separating that out into a virtual machine on top of the server. A little less inefficient but miles more portable.
Edit from Abraham:
I wound up using the methodology, but I wanted it in a python management task. My implementation did the same thing, but it looked more like this:
from django.core.management.base import BaseCommand, CommandError
import subprocess, os
from multiprocessing import Process
sub = Process(target=subprocess.call, args=(('Xvfb', ':10', '-ac',), ))
env = os.environ.copy()
env['DISPLAY'] = ":10"
tasks = ('random','management','commands','thatneedDISPLAY:X')
for task in tasks:
p = subprocess.call(['python','manage.py',task],env=env)
args = 'none'
help = '''Run all daily tasks.'''
def handle(self, *args, **options):