Virtual Frame Buffer (xvfb) is a great package. All it does is provide an X11 interface in memory instead of requiring a screen. Below I detail what I do on Ubuntu, but it should work the same on any Linux distro.
Installing Firefox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install firefox |
Testing Firefox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo $DISPLAY | |
localhost:10.0 | |
$ firefox |
Installing Xvfb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install xvfb | |
...Lots of stuff... |
Testing Firefox again
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install imagemagick | |
$ Xvfb :1 & | |
$ export DISPLAY=:1 | |
$ firefox http://google.com | |
...from another terminal... | |
$ export DISPLAY=:1 | |
$ import -window root example.png | |
...from another terminal... | |
$ killall firefox | |
$ firefox example.png |
Create a xvfb startup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/bin/Xvfb :1 & |
Getting the CI server to use the VFB
At this point getting a CI server to use Xvfb will depend on how it is started. If you use the Xvfb startup script then the display is :1. All you have to do is export DISPLAY=:1 before the CI server starts.