Você pode usar xvfb-run your-command
. Ele cuida da configuração e limpeza.
Da página do manual:
xvfb-run is a wrapper for the Xvfb(1x) command which simplifies the task of running commands (typically an X client, or a script containing a list of clients to be run) within a virtual X server environment. xvfb-run sets up an X authority file, writes a cookie to it (see xauth(1x)) and then starts the Xvfb X server as a background process. The process ID of Xvfb is stored for later use. The specified command is then run using the X display corresponding to the Xvfb server just started and the X authority file created earlier.
When the command exits, its status is saved, the Xvfb server is killed (using the process ID stored earlier), the X authority cookie removed, and the authority file deleted. xvfb-run then exits with the exit status of command.