Some programs insist on a display, even when I only want a screenshot or a test run on a server. A virtual screen solves that.
xvfb-run starts a virtual X server, runs your command inside it and stops it afterwards:
xvfb-run -a your-program --some-flag
The -a (--auto-servernum) option picks a free server number, starting at 99. Without it, xvfb-run uses server number 99 (the default). To change the screen size, pass server arguments with -s; the default is -screen 0 1280x1024x24:
xvfb-run -a -s "-screen 0 1920x1080x24" your-program
A caveat: nothing is shown anywhere. The program draws into memory, so you need a screenshot tool or the program’s own output to see what happened. On Debian and Ubuntu the package is called xvfb.
Further reading: xvfb-run man page (Debian)