
Virtual Display in Java VNC Viewer
This is a small solution to running GUI apps that require X on a headless server without installing a full blown desktop environment or needing a graphics card for display.
After searching for different solutions to get a remote X display i found a way that will do it with very little overhead and works nicely. By starting a virtual X frame buffer on display :1 any apps requiring X can be started on it without the need for any graphics card or a full X11 install.
A VNC server such as x11vnc can be used to access the virtual X display on a remote system and the vnc-java package can allow you to connect to it and use the apps in a web browser.
Heres what needs to be done:
Install the packages required
$ sudo apt-get install xvfb x11vnc vnc-java blackbox xterm
Start Xvfb to create a 800*600 display on :1
$ Xvfb :1 -screen 0 800×600x16 -ac &
Start blackbox window manager on the display
$ DISPLAY=:1 blackbox &
Create a password file for x11vnc
$ x11vnc -storepasswd
Start x11vnc using display :1
$ x11vnc -display :1 -usepw &
OR
Start x11vnc with the java web viewer so you can access it in a web browser and without needing a VNC client
$ x11vnc -display :1 -httpdir /usr/share/vnc-java -httpport 5800 -usepw -forever &
This can also be run with the -ssl and -https tags to get ssl encryption support
You should be able to access the server now on port 5800 in a web browser like:
http://server:5800/
Log in with the password created earlier. To run a app in the new display right click and select xterm to bring up a terminal. The GUI apps can then be started from the terminal and can be controlled in any VNC Client
It can also be started in startup scripts at bootup if you want the remote X display to start accross reboots.